0
Please help in C++
4 Respostas
+ 1
//Does it work like this?
#include <iostream>
using namespace std;
int main()
{
int x;
int y;
cout<<"Please type a number\n";
cin>>x;
cout<<"Please type another number\n";
cin>>y;
int sum=x+y;
int difference=x-y;
int multiply=x*y;
int divide=x/y;
int modulus=x%y;
cout<<"Their sum is"<<sum<<"\n"
<<"Their difference is"<<difference<<"\n"
<<"Their multiplication is"<<multiply<<"\n"
<<"Their division is"<<divide<<"\n"
<<"Last but not the least,Their remainder is"<<modulus<<"\n";
cout<<"Thanks and please guide me as I am just starting out and it will really motivate me!!"
<<"-ARTN";
return 0;
}
+ 1
Because your program is run from top to bottom.
And if you place this in front of the "cin >>" statements, x and y are just trash values.
0
let me try
0
it worked
can u kindly tell me the reason....
thx a lot btw