0

I want to know, how to write the size of first string in vector after execution. Is my statement in the code correct?

https://code.sololearn.com/cG5uxAtYBcuQ/?ref=app

23rd Sep 2021, 4:49 AM
TeaserCode
3 Respuestas
+ 1
What is it are you trying to do? I see you try to implement sorting algorithm in your code but I also don't understand the output of your code. If what you want is to simply "write the size of first string in vector" then you can simply do std::cout << vector[ 0 ].size(); Where <vector> is a vector of std::string. But looking at your code, I failed to see the connection between the code and your question.
23rd Sep 2021, 5:44 AM
Ipang
+ 1
these are some of the mistakes you are making. for ( int i = 0 ; i < list.size()-1; i++ ) for (auto s : list) result.append(s + ' ' + to_string(s.length()) + "\n" ); or string result[list.size()];
23rd Sep 2021, 7:11 AM
SoloProg
SoloProg - avatar
0
I want to lexicographicaly find the first element in vector, then output this element with a string "***" between each character. For traversing through the length of the element I used to know the size. Somehow I do that, but it seems strange to me. This compiler print it, but particular one reports undefined behavior.
23rd Sep 2021, 12:48 PM
TeaserCode