Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // cin with strings
- #include <iostream>
- #include <string>
- using namespace std;
- int main ()
- {
- string mystr;
- cout << "What's your name? ";
- getline (cin, mystr);
- cout << "Hello " << mystr << ".\n";
- cout << "What is your favorite team? ";
- getline (cin, mystr);
- cout << "I like " << mystr << " too!\n";
- return 0;
- }
- What's your name? Homer Simpson
- Hello Homer Simpson.
- What is your favorite team? The Isotopes
- I like The Isotopes too!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement