Thanks a BUNCH stack.
That was a great explaination and I'm glad to be welcomed like that, you don't normally see someone help a new person (or at least put in that much effort).
I'm on my second assignment now which I have to write a program that will ask the user for one of three choices.
for example:
Press c to calculate the area of a circle, t for a triangle, r for a rectangle, or q for quit.
Then the program comes and asks if you typed in c
"What is the radius of the circle?"
you input the radius then it spits out the area of the circle then loops back to the main question until you hit q to quit. I have the concept down of what I want to do with it but I know there is more to it. Here is what I've got so far.
#include<iostream>
using namespace std;
float answer;
int main()
{
char shape;
double height, width, base, radius;
cout<< "Press r for rectangle, t for triangle, or c for circle " << "\n";
cin>> shape;
if(shape=='r'||shape=='R')
{
double height, width, answer;
cout<< "Enter the Height:";
cin>> height;
cout<< "Enter the Width:";
cin>> width;
answer = height * width;
cout<< "The area is: " << answer << "\n";
}
elseif(shape=='t'||shape=='T')
{
double height, base;
cout<< "Enter the height:";
cin>> height;
cout<< "Enter the base length:";
cin>> base;
answer = base * height * .5;
cout<< "The area is: " << answer << "\n";
}
elseif(shape=='c'||shape='C')
{
double radius;
cout<< "Enter the Radius:";
cin>> radius;
answer = radius * 3.1419;
cout<< The area is: " << answer << "\n";
}
return(0)
}
// I'm sick of trying to figure this out
Thanks for any help you can give.