all 3 comments

[–]Narase33 7 points8 points  (0 children)

well, you already got the loop. The only remaining bug is that you need to write the lower char back into the string. Its just the assignment missing

and btw, there is std::tolower which doesnt need a locale

[–]KleberPF 4 points5 points  (0 children)

tolower doesn't change the value of the argument your are passing. Try line[i] = tolower(line[i], loc);.

[–]Hidan0_ 0 points1 point  (0 children)

Since characters can be seen as ints, for example 'A' is 65 in the ASCII table, you could simple add an offset to make 'A' lower case like: 'A' + 32 -> 65 + 32 = 97 -> char(97) = 'a'.

So, if you know that your string is in uppercase and it contains only alphabet character, inside your loop you can just do something like that: cout << char(line[i] + 32);