can someone help me debug this please.

// Allows user to select an option and displays the price
void main()
char answers[5] = {'a', 'b', 'c', 'd'; 'e'};
double price[5] = {149.95, 215.66, 239.77, 308.11, 500.99};
char selection;
int x;
cout<<"Enter your choice of our hotel suites"<<endl;
cout<<"a for the alyse, b for the botanical, c for the crimson"<<endl;
cout<<"d for the darlton, or e for the edwardian"<<endl;
cout<<"Enter x to quit ";
while(selection = 'x')
for(x = 0; x<= 5 ; ++x)
if(selection == answers[x])
cout<<"Price $"<<price[x]<<endl;
cout<<"Enter next selection or z to quit ";
cout<<"Thank you!"<<endl;
This while(selection = 'x') is the problem. You assign 'x' to selection. Change to:

while(selection == 'x') // Note: == for comarison, = for assigning

Notice the ==.
Topic archived. No new replies allowed.