how to get input from the console in c 2b 2b

Solutions on MaxInterview for how to get input from the console in c 2b 2b by the best coders in the world

showing results for - "how to get input from the console in c 2b 2b"
Juliana
28 May 2020
1// cin with strings
2#include <iostream>
3#include <string>
4using namespace std;
5
6int main ()
7{
8  string mystr;
9  cout << "What's your name? ";
10  getline (cin, mystr);
11  cout << "Hello " << mystr << ".\n";
12  cout << "What is your favorite team? ";
13  getline (cin, mystr);
14  cout << "I like " << mystr << " too!\n";
15  return 0;
16}
Leyna
16 Feb 2018
1int age;
2cin >> age;