I'm trying to get a program to branch out into two different directions without the use of multiple CPP codes. But it's not going very well
1 2 3 4 5 6 7 8 9
char BINARY, DECIMAL, HOLD;
cout << "What do you want? A Chicken or Beef?" << endl;
cin >> CHICKEN, BEEF;
if (cin.get (CHICKEN) || CHICKEN)
cout << "A chicken had to die for you!!!" << endl;
elseif (cin.get (BEEF) || BEEF)
cout << "A cow had to die for you!!!" << endl;
cin >> HOLD;
On the if statements, I wasn't sure how to compare characters so I just used || which kind of works since I'm not getting fatal errors. But when I run it and type in CHICKEN or BEEF, nothing would show. Cool or Uncool would not show and then it would end. I kind of know how to use if statements with numeric values but not with non-numeric values. So I'd just like to know how to make it at least show something at this point.
in line 4 you want to read two variables from the user where you only need one.
So line 4 should be something like
1 2
char *choice;
cin >> choice;
And then you just compare the Input choice with Chicken or Beef:
1 2 3 4
if (choice == "Chicken") // Important: to compare, you need ==, the = operator will simply assign the value of the right-hand variable to the left-hand variable.
//
elseif
//