48

CinCout

  1. #include <iostream>
  2. #include <cstdlib>
  3.  
  4. int main() {
  5.     using std::cin;
  6.     using std::cout;
  7.     using std::endl;
  8.  
  9.     int a, b;
  10.  
  11.     cout << "Enter two numbers: ";
  12.     cin >> a >> b;
  13.  
  14.     cout << "You have typed in " << a << " and " << b << "." << endl;
  15.     cout << "Their sum is " << (a+b) << "." << endl;
  16.     cout << "Their difference is " << (a-b) << "." << endl;
  17.     cout << "Their product is " << (a*b) << "." << endl;
  18.     cout << "Their quotient is " << (a/b) << "." << endl;
  19.     cout << "Their rest is " << (a%b) << "." << endl;
  20.  
  21.     exit( 0 );
  22. }
$ 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

Your comment:
[p] [b] [i] [u] [s] [quote] [pre] [br] [code] [url] [email] strip help 2000

Enter a maximum of 2000 characters.
Improve the presentation of your text with the following formatting tags:
[p]paragraph[/p], [b]bold[/b], [i]italics[/i], [u]underline[/u], [s]strike[/s], [quote]citation[/quote], [pre]as is[/pre], [br]line break,
[url]http://www.izend.org[/url], [url=http://www.izend.org]site[/url], [email]izend@izend.org[/email], [email=izend@izend.org]izend[/email],
[code]command[/code], [code=language]source code in c, java, php, html, javascript, xml, css, sql, bash, dos, make, etc.[/code].