I'm trying to write a program that inputs a char value and depending on what that value is, does a specific calculation with another value. When i try to declare my char values, I get this message: "type 'char' unexpected" after building.
I'm very new to writing programs. I use Microsoft Visual C++ 2010 Express.
So far the beginning of my program looks like this:
{ // open program
const double pi = 3.14159265; //declare and initialize pi
char formula; //declare char and double variables
char A, char C, char D;
double radius;
double area, double circumference, double diameter;
I hope someone can help me, because I think I'm just missing something small, but I can't find anything in my textbook or class notes.
Thank you!
char A, char C, char D shouldn't all be on the same line in that format. Either put char A, C, D; or each one on its own line. Same thing with your area/circumference/diameter declarations.
I'd suggest reading some sample programs to get a better idea on the syntax of the language and try to mess around with it more.