program errror

I am a beginner and am trying to write a calculator program. Each time I write a line I compile it to make sure its working....It is fine till I write line 26..when I wrote cin >> choice; What is wrong with that... pls help..thanks



using namespace std;
float addition(float num1, float num2)
{
return num1 + num2;
}
float sutraction(float num1, float num2)
{
return num1 - num2;
}
float multiplication(float num1, float num2)
{
return num1 * num2;
}
float division(float num1, float num2)
{
return num1 / num2;
}


int main(int argc, char *argv[])
{
float number1;
float number2;
int choice;
cout << "Choose your operation. 1 = Adding. 2 = Sutraction. 3 = Multiplication 4 = Division" << endl;
cout << "choice: ";
cin >> choice;
if(choice==1)
{
//Addition
cout << "You are adding. Enter the first number you would like to add \n Number 1: ";
cin >> number1;
cout << "Enter the second number. \n Number 2: ";
cout << "The answer is: " << addition(number1, number2) << endl;
}
else
{
if(choice==2)
{

}





system("PAUSE");
return EXIT_SUCCESS;
}
Why is this in the lounge? lol

Can you use code tags in future please? They make the code format well...

You're missing a closing tag on your else, which should be giving you a compiler error saying you're missing a closing brace? That else is not needed here anyway?
You also do not ask for number2, so it will be undefined in addition(number1,number2).
You should also not use system and what is wrong with return 0; ?
just put a '}' at the end of the program
and you are not asking for num2
and better you may use int data type for addition and subtraction otherwise answer coming will be a bit complicated :)
Topic archived. No new replies allowed.