12

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.

Commentaires

Votre commentaire :
[p] [b] [i] [u] [s] [quote] [pre] [br] [code] [url] [email] strip aide 2000

Entrez un maximum de 2000 caractères.
Améliorez la présentation de votre texte avec les balises de formatage suivantes :
[p]paragraphe[/p], [b]gras[/b], [i]italique[/i], [u]souligné[/u], [s]barré[/s], [quote]citation[/quote], [pre]tel quel[/pre], [br]à la ligne,
[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]commande[/code], [code=langage]code source en c, java, php, html, javascript, xml, css, sql, bash, dos, make, etc.[/code].