Assigning x in If statement

I have an imbedded if statement with a menu that is listed by A, B, C instead of numbers. I know I cannot assign x to A, B, and C in the if statement, but I do not know how to assign it properly. Can anyone help? thanks.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# include <iostream>
using namespace std; 

int main () {
	char x;
	int hour;
	double TotalA = 0, TotalB = 0, TotalC = 0; 
	cout << "Please enter the letter A, B, or C:"; 
	cout << "Package A: For $9.90 per month 20 hours of access are provided. Additional hours are $2.00 per hour." <<endl;
	cout << "Package B: For $14.90 per month 30 hours of access are provided. Additional hours are $1.00 per hour." <<endl;
	cout << "Package C: For $19.90 per month unlinmited access is provided."<<endl; 
	cin >> x; 
	
	if ( x = A,x = B, x = C)
	{ cout <<"How many hours used:";
	  cin >> hour;
You have a very poorly designed condition that is probably wrong.
This is what you are looking for:
x == A && x == B && x == C
Read this: http://www.cplusplus.com/doc/tutorial/control/
And don't forget surrounding curly brackets.
Now why can't you assign x to a b and c? I don't even see an a b and c.
Actually it looks like he needs characters (not variables A, B, C)

And || makes much more sense:

 
if(x == 'A' || x == 'B' || x == 'C')
Topic archived. No new replies allowed.