So i wrote a multiply-only calculator program, and it functions fine except for that when i attaempt to multiply the two values, it gives me a ridiculous product. here is the code:
#include <iostream>
using namespace std;
int main()
{
int a,b;
cout<<"Please enter two numbers separated by a space:\n";
cin>>a,b;
cout<<"The product of the two numbers is:\n";
cout<<a*b;
system ("PAUSE");
return 0;
}
i tried to muktiply "8" and "2",and the result i got was "18348608" please tell me what is going on. thank you.
The simple answer is that it causes the system to display "Press any key to contine" and then waits for a keypress. This stops the console window closing before you have a chance to see what your program output is.