-
Help me. I'm new
Well I was trying to learn how to do switches in a program. I typed it all out and then when i went to compile it, it said that there was unidentified reference to 'boy1(void)' . It did that for boy2, and girl1. Anyway here is the program:
Code:
#include <iostream.h>
#include <stdlib.h>
int main()
{
int input;
int boy1();
int boy2();
int girl1();
cout<<"Who is this?"<<endl;
cout<<"1. Boy1"<<endl;
cout<<"2. Boy2"<<endl;
cout<<"3. Girl1"<<endl;
cout<<"4. Exit"<<endl;
cin>>input;
switch (input)
{
case 1: boy1();
cout<<"He is 15 years old."<<endl;
system("PAUSE");
break;
case 2: boy2();
cout<<"He is 13 years old."<<endl;
system("PAUSE");
break;
case 3: girl1();
cout<<"She is 10 years old."<<endl;
system("PAUSE");
break;
case 4:
return 0;
default:
cout<<"Error, bad input, quitting";
}
return 0;
}
Please help me. I am new and I want to learn C++. Thank you.
-
>> int boy1();
>> int boy2();
>> int girl1();
Get rid of the brackets. They're making your compiler think that boy1, 2, and girl1 are all functions.
-
Thank you.
That worked perfectly.
Thank you, again.:D :D