Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- // read an int value from the keyboard
- int age;
- cout << "What is your age? ";
- cin >> age;
- cin.ignore(1000, 10);
- // read a double value from the keyboard
- double gpa;
- cout << "What is your grade point average? ";
- cin >> gpa;
- cin.ignore(1000, 10);
- // read a string value from the keyboard
- string name;
- cout << "What is your name? ";
- getline(cin, name);
- // read a char value from the keyboard
- char gender;
- cout << "What is your gender? [M/F]: ";
- cin >> gender;
- cin.ignore(1000, 10);
- return 0;
- }
Add Comment
Please, Sign In to add comment