how to ignore CAPS

i remember learning about a way to make it so you can enter sothing ether caps or lowercase and it does not matter what is the code for that?


1
2
3
4
5
6
7
8
9
10
11
cout<<"Welcome to Craps"<<endl;
        cout<<"each game will cost you 5 chips"<<endl;
        cout<<"You have "<< chips <<" chips"<<endl;
        cout<<"Type start when you are ready to play"<<endl;
        string start;
        cin>>start;
if (start=="start"){
}
else{
}
Last edited on
Make string lowercase before comparing:
1
2
3
4
5
6
7
8
#include <algorithm>
#include <cctype>
//--------------------------------------------
//...
cin>>start;
std::transform(start.begin(), start.end(), start.begin(), ::tolower);
if (start=="start"){
//... 
Topic archived. No new replies allowed.