I am trying to let the user input a character (a-z). If they put in a capital letter (A-Z), I want it to convert it to a lowercase. What am I doing wrong?
1 2 3 4 5 6
char p1choice;
cout << "Choose the square you want: ";
cin >> p1choice;
tolower(p1choice);
The computer does not differentiate between data types. It sees a number. The data type is determined on how the code processes the number...
Check out http://www.asciitable.com/ and you'll see that capital and lower case all have a difference of 32. So you can build a simple converter by checking if the value is between 65 and 90. If so, add 32. You now have capital letters.