That relief at around 3min when you point out that the code is horrible. Though unless the point of the exercise was to get the length manually, one issue is that it's just plain C with cout thrown in. To be extra lazy (also using C++23 and println instead of cout), there is no need for raw loops and getting the length of anything. for (auto s : str) { for (auto c : string_view(s)) println("{}", c); println(); }
I have never written a line of C++ and may never, but I was randomly suggested this and enjoyed it! Clear and concise, nice work!
That relief at around 3min when you point out that the code is horrible. Though unless the point of the exercise was to get the length manually, one issue is that it's just plain C with cout thrown in. To be extra lazy (also using C++23 and println instead of cout), there is no need for raw loops and getting the length of anything.
for (auto s : str) {
for (auto c : string_view(s)) println("{}", c);
println();
}
Thank you for following. More idiomatic C++ will be introduced gradually, step by step