this compiles but still doesnt run...what am I doing wrong?
Code:
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int choice=0, num1=0, num2=0, result=0;
while ( choice != 0 )
{
cout << "Enter 1 for addition\n"
<< "Enter 2 for subtraction\n"
<< "Enter 3 for multiplication\n"
<< "Enter 4 for Division\n"
<< "Enter 0 to exit program";
cin >> choice;
cout << "Enter number 1:";
cin >> num1;
cout << "Enter number 2:";
cin >> num2;
/* Now use the value of choice to determine the result */
if (choice == 1)
{
result = num1 + num2;
}
else if (choice == 2)
{
result = num1 - num2;
}
else if (choice == 3)
{
result = num1 * num2;
}
else if (choice == 4)
{
result = num1 / num2;
}
/* inside the { [..] }'s you assign a value to result
depending on what the user wants to do with the numbers */
cout << "Result = " << result;
}
return EXIT_SUCCESS;
}