52
CinCout
- #include <iostream>
- #include <cstdlib>
- int main() {
- using std::cin;
- using std::cout;
- using std::endl;
- int a, b;
- cout << "Enter two numbers: ";
- cin >> a >> b;
- cout << "You have typed in " << a << " and " << b << "." << endl;
- cout << "Their sum is " << (a+b) << "." << endl;
- cout << "Their difference is " << (a-b) << "." << endl;
- cout << "Their product is " << (a*b) << "." << endl;
- cout << "Their quotient is " << (a/b) << "." << endl;
- cout << "Their rest is " << (a%b) << "." << endl;
- exit( 0 );
- }
$ make
g++ -DDEBUG -g -c -o cincout.o cincout.cpp
g++ cincout.o -o cincout
$ cincout
Enter two numbers: 13 3
You have typed in 13 and 3.
Their sum is 16.
Their difference is 10.
Their product is 39.
Their quotient is 4.
Their rest is 1.
Comments