cout << "Which equation do you want to perform? ";
int z;
cin >> z;
if ( z==1)
{
system("clear");
cout << "Enter the first number: " << endl;
double a;
cin >> a;
cout << "Enter the second number: " << endl;
double b;
cin >> b;
system("clear");
cout << "The first number you entered was " << a << "." << endl;
cout << "The second number you entered was " << b << "." << endl;
cout << a << " + " << b << " = " << a+b << endl;
}
if ( z==2);
{
system("clear");
cout << "Enter the first number: " << endl;
double c;
cin >> c;
cout << "Enter the second number: " << endl;
double d;
cin >> d;
system("clear");
cout << "The first number you entered was " << c << "." << endl;
cout << "The second number you entered was " << d << "." << endl;
cout << c << " - " << d << " = " << c-d << endl;
}
if (z==3);
{
system("clear");
cout << "Enter the first number: " << endl;
double e;
cin >> e;
cout << "Enter the second number: " << endl;
double f;
cin >> f;
system("clear");
cout << "The first number you entered was " << e << "." << endl;
cout << "The second number you entered was " << f << "." << endl;
cout << e << " divided by " << f << " = " << e/f << endl;
}
if (z==4);
{
system("clear");
cout << "Enter the first number: " << endl;
double g;
cin >> g;
cout << "Enter the second number: " << endl;
double h;
cin >> h;
system("clear");
cout << "The first number you entered was " << g << "." << endl;
cout << "The second number you entered was " << h << "." << endl;
cout << g << " x " << h << " = " << g*h << endl;
}
cout << "Thanks for using Mini Calculator 3.0. Good-bye" << endl;
return 0;
}
It asks you which equation you wan to do, then it asks you for the two numbers, then it gives you results. The problem is that this progam will ask you for two results for every single equation, but only give you the last results. I used the IF statements but they didn't work. It's as if the program igores the if functions and just goes striaght done. It's annoying. Please Help ASAP!!! Thank-you