M
M
marlaaa2022-04-06 20:35:28
C++ / C#
marlaaa, 2022-04-06 20:35:28

Sort strings alphabetically. How does it work in detail?

for (int i = 0; i <= t; i++)
            {
                for (int j = 0; j < t - 1; j++)
                {
                    if (ende[j].name > ende[j + 1].name)
                    {
                        string k = ende[j].name;
                        ende[j].name = ende[j + 1].name; // поменяла мeстами 
                        ende[j + 1].name = k;
                    }
                }
                cout << ende[i].name << endl;
            }
        }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question