Help! Calculator Not Working...What is wrong?
Nothing wrong with compling, all done, but the EXE will not work when I calculate it.
Some One Know What is going on?
Code:
int main ()
{
cout << "welcome to My First Calc!";
cout << "Enter The ID Of the Task.\n 1.Add\n2.Subtract\n3.Multiply\n4 Divide\n";
int taskid;
cin >> taskid; // taskid is the Task ID.
cout << "Enter the first number.\n";
int num1;// the First Number
cin >> num1;
cout << "Now the Second.\n";
int num2;// the second number
cin >> num2;
int result; // defining the result variable earlier
if (taskid == 1)
{
cout << "Results:";
result = num1 + num2;
cout << result;
cout << "Bye!";
cin.get();
}
else if (taskid == 2)
{
cout << "Results:";
result = num1 - num2;
cout << result;
cout << "Bye!";
cin.get();
}
else if (taskid == 3)
{
cout << "Results:";
result = num1 * num2;
cout << result;
cout << "Bye!";
cin.get();
}
else if (taskid == 4)
{
cout << "Results:";
result = num1 / num2;
cout << result;
cout << "Bye!";
cin.get();
}
else
{
cout << "Error:UNknown Task ID";
cout << "Bye!";
cin.get();
}
}
Testing Enviroment:
Windows 7 64Bit
IDE:
Dev-C++ 7.4.2 (Portable)