Hi everyone!
I am trying to understand tolower function... I don't get the locale variable to be honest and I would also like to know what I have to do so as to save the lower case string to another string and not just print it! That's my code...
#include <iostream>
#include <string>
#include <cctype>
#include <locale>
using namespace std;
int main()
{
locale loc;
int i,k,l;
string str="Test String";
for (i=0;i<str.length();i++)
cout<<tolower(str[i],loc);
cout<<endl;
char tmp;
for (k=0;k<str.size()-1;k++)
{
for (l=k+1;l<str.size();l++)
{
if (str[k]>str[l])
{
tmp=str[k];
str[k]=str[l];
str[l]=tmp;
}
}
}
cout<<str<<endl;
return 0;
}
Thank you :)