0
I want to know, how to write the size of first string in vector after execution. Is my statement in the code correct?
3 Respostas
+ 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.
+ 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()];
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.