eXtensible
Baseband Member
- Messages
- 37
- Location
- Earth
Hi eXtensible here,
I've been working on a C++ app that replaces the standard Calculator app with a simple but more advanced Scientific Calculator, i've gotten as far as basic math functions but that's where the problem lies, I have funcitons for +ing, -ing, *ing, and /ing, but the problem is no matter what function i select when i run it, It does nothing but addition.
Here's the Source Code:
I've been working on a C++ app that replaces the standard Calculator app with a simple but more advanced Scientific Calculator, i've gotten as far as basic math functions but that's where the problem lies, I have funcitons for +ing, -ing, *ing, and /ing, but the problem is no matter what function i select when i run it, It does nothing but addition.
Here's the Source Code:
Please Help Me!#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int a;
cout << "What would you like to do ? " << endl << "HINT: 1 = add, 2 = subtract, 3 = multiply, 4 = divide " << endl;
cin >> a;
if (a = 1);
{
double a;
cout << "Enter the first number: ";
cin >> a;
double b;
cout << "Enter the second number: ";
cin >> b;
double c;
c = a + b;
cout << "Calculating: " << c << endl;
system("PAUSE");
return 0;
}
if (a = 2);
{
double a;
cout << "Enter the first number: ";
cin >> a;
double b;
cout << "Enter the second number: ";
cin >> b;
double c;
c = a - b;
cout << "Calculating: " << c << endl;
system("PAUSE");
return 0;
}
if (a = 3);
{
double a;
cout << "Enter the first number: ";
cin >> a;
double b;
cout << "Enter the second number: ";
cin >> b;
double c;
c = a * b;
cout << "Calculating: " << c << endl;
system("PAUSE");
return 0;
}
if (a = 4)
{
double a;
cout << "Enter the first number: ";
cin >> a;
double b;
cout << "Enter the second number: ";
cin >> b;
double c;
c = a / b;
cout << "Calculating: " << c << endl;
system("PAUSE");
return 0;
}
system("PAUSE");
return EXIT_SUCCESS;
}