I am quite new to programming in Cpp and I cannot figure out how to get the program to deny "B" as a value for cat. I want it to only accept "Ba". Is there way to get it to only accept certain strings and not parts of them?
#include <iostream>
using namespace std;
string cat;
float catc;
int main ()
{
cin cat;
if (cat == "Ba") //this part also accepts "B" and "a", I want it only to accept
//"Ba" so that it will skip over this statement and go to the else if statement.
{
cout << "cat = 5";
}
else if (cat == "B")
{
cout << "cat = 3";
}
}