daily pastebin goal
15%
SHARE
TWEET

Untitled

a guest Dec 7th, 2017 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.   // read an int value from the keyboard
  8.   int age;
  9.   cout << "What is your age? ";
  10.   cin >> age;
  11.   cin.ignore(1000, 10);
  12.  
  13.   // read a double value from the keyboard
  14.   double gpa;
  15.   cout << "What is your grade point average? ";
  16.   cin >> gpa;
  17.   cin.ignore(1000, 10);
  18.  
  19.   // read a string value from the keyboard
  20.   string name;
  21.   cout << "What is your name? ";
  22.   getline(cin, name);
  23.  
  24.   // read a char value from the keyboard
  25.   char gender;
  26.   cout << "What is your gender? [M/F]: ";
  27.   cin >> gender;
  28.   cin.ignore(1000, 10);
  29.    
  30.   return 0;
  31. }
RAW Paste Data
Top