while menu.

I am trying to create a menu, its started ok it asked me to repeat the program but this it doesn't do it properly.


{
char letter;
int corners=0;
double x[10], y[10], depth=0, area=0, centroid=0, volume=0;
float totaldistance[10],perimeter[10];
cout<<"Press S to start or Q to quit"<<endl;
cin>>letter;
while (letter != 'Q' && letter != 'q')

{
if ((letter == 'S' )||(letter =='s'))
{ corners_of_pool (corners,letter);
depth_of_pool (depth);
coordinates_of_corners (corners, x, y);
distance_between_two_corners (corners, x, y, totaldistance);
perimeter_of_pool (corners, totaldistance, perimeter);
area=area_of_pool ( corners, x, y);
centroid= centroid_of_pool ( corners, x, y, area);
volume = volume_of_the_pool ( depth, area);
}
cout<<"Press S to start again or Q to quit"<<endl;
cin>>letter;
}
return 0;
}
Last edited on
In your while loop you have something like "if the letter is a capital Q AND also a lowercase q then do the stuff in the loop.
Try changing it to capital Q OR lowercase q, i.e while(letter != 'Q' || letter != 'q')
Topic archived. No new replies allowed.