I'm doing a prog that take the user input and prefixes each alpa numeric character and the '.' character, with "*jl" otherwise it leaves it alone.
It works, the problem is it doesn't do it for uppercase, how I can modifly it so that it converts the user input cin to all lower case?
cin.get().toLowerCase() isn't working, I saw that somewhere...
Code:
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
using std::cout;
using std::string; using std::cin;
string alphaNumericData = "abcdefghijklmnopqrstuvwxyz.0123456789";
string e = "*jl";
int main()
{
char ch;
while ( (ch = cin.get()) != EOF){
unsignedint loc = alphaNumericData.find( ch, 0 );
if( loc != string::npos )
cout << e + ch;
else cout << ch;
}
return 0;
}