My program runs and I can do addition and subtraction just fine but the multiplication and division don't seem to be wanting to work. I have searched online and am sure that the correct characters are * and / Here's what I have so far.
The program runs, but when entering a division problem for example, the program does some weird beeping and a ton of stuff flashes and it crashes.
#include <iostream>
#include <Windows.h>
int a, b, sum, difference, multiply, divide;
usingnamespace std;
int main()
{
cout << "Enter your problem with this format: 5+2 or 20-6 then press enter.\n";
for (int i = 1; i < 1000; i++)
{
cin >> a >> b;
difference = a - b;
sum = a + b;
multiply = a * b;
divide = a / b;
if (a + b)
{
cout << sum;
cout << "\n___________\n";
}
elseif (a - b)
{
cout << difference;
cout << "\n___________\n";
}
elseif (a * b)
{
cout << multiply;
cout << "\n___________\n";
}
elseif (a / b)
{
cout << divide;
cout << "\n___________\n";
}
}
}