rihardmarius

tp 25.04.13

Apr 25th, 2013
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     //declaracion de variables
  9.  
  10.     int int1;
  11.     char char1;
  12.     bool bool1;
  13.     double double1;
  14.     string string1;
  15.  
  16.     //ingreso de datos
  17.  
  18.     cout << "1) Ingresar int: ";
  19.     cin  >> int1;
  20.     cout << "2) Ingresar char: ";
  21.     cin  >> char1;
  22.     cout << "3) Ingresar bool (0 falso, 1 verdadero): ";
  23.     cin  >> bool1;
  24.     cout << "4) Ingresar double: ";
  25.     cin  >> double1;
  26.     cin.ignore();
  27.     cout << "5) Ingresar string: ";
  28.     getline(cin,string1);
  29.  
  30.     //muestra de datos
  31.  
  32.     cout << "\n\nDatos ingresados:\n";
  33.     cout << "Int: " << int1 << endl;
  34.     cout << "Char: " << char1 << endl;
  35.     if (bool1)
  36.       cout << "Bool: true\n";
  37.       else
  38.       cout << "Bool: false\n";
  39.     cout << "Double: " << double1 << endl;
  40.     cout << "String: " << string1 << endl;
  41.  
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment