Advertisement
rihardmarius

tp 25.04.13 1.1

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