I have the following console program on qtcreator 4.7.
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int a;
int b;
int result = a * b;
cout<<"Enter a";
cin>>a;
cout<<"Enter b";
cin>>b;
cout<<"You entered"<<a<<"and you entered"<<b<<"Their product is"<<result<<endl;
cout << "Press any key to exit..." << endl;
system ("pause");
return 0;
}
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int a;
int b;
int result = a * b;
cout<<"Enter a";
cin>>a;
cout<<"Enter b";
cin>>b;
cout<<"You entered"<<a<<"and you entered"<<b<<"Their product is"<<result<<endl;
cout << "Press any key to exit..." << endl;
system ("pause");
return 0;
}
To copy to clipboard, switch view to plain text mode
When i input 5 and 9,i get You entered5and you entered9Their product is-2009147472
why am i not getting 45?.
Bookmarks