So, Daniweb. My teacher has been teaching us some old C++ (a problem I've been trying with little avail to rectify). I need y'all wonderful people to look over a section of code that I'm having trouble with. It has to do with recognizing a letter in an if statement. The problem is that I can't get it to recognize Y as a valid entry, so it always just skips to the subsequent else. Halp pluzz?
It's part of a menu that determines answers for volume and area problems. This one is for the volume of a cylinder (area of base*height). And the braces are all in the right places, it's just nested like 2349087 times.
Choice3 is also declared as a char in case you saw that.
else if (choice2==4)
{
cout<<"Enter the height: ";
cin>>height;
cout<<"Do you know the area of the base? ";
cin>>choice3;
if (choice3=='89')
{
cout<<"Enter the area of the base: ";
cin>>basearea;
}
else
{
cout<<"Enter the radius of the base: ";
cin>>radius;
basearea=pi*pow(radius,2);
}
volume=basearea*height;
cout<<"The volume is "<<volume<<" units cubed."<<endl<<endl;
}
Word of the day: Sloppy
/slop.pee/ adj. Me.