So, my friend asked me to come up with a program that does basic math problems. (Multiple, Divide, Add,Subtract)
I can make a single one work, but I don't want to make four projects.
I wanted to put it into one project.
So, I was messing around, and this is what I got so far, it shows both answers, and I only want it to show the answer I asked for.
Code:
/*Homework finisher
*/
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
int x;
cout << "Enter the first number of your problem:";
cin >> x;
int y;
cout << "Enter the second number of your problem:";
cin >> y;
int divider;
cout << "1 for Divide, 2 for multiply, 3 for addition, 4 for subtraction";
cin >> divider;
if (1);
int result1;
result1 = x / y;
if (2);
int result2;
result2 = x * y;
if (1)
cout << "Answer is:";
cout << result1 <<endl;
if (2)
cout << "Answer is:";
cout << result2 <<endl;
system("PAUSE");
return 0;
}