Answers for "cin c++"

C++
9

how to grab all of user input c++

// 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;
}
Posted by: Guest on December-17-2019
5

how to get input in cpp

// i/o example

#include <iostream>
using namespace std;

int main ()
{
  int i;
  cout << "Please enter an integer value: ";
  cin >> i;
  cout << "The value you entered is " << i;
  return 0;
}
Posted by: Guest on November-03-2020
4

how to get input from the console in c++

int age;
cin >> age;
Posted by: Guest on March-04-2020
7

C++ user input

int x; 
cout << "hurry, give me a number!: "; // Type a number and press enter
cin >> x; // Get user input from the keyboard
cout << "you picked: " << x << " !" // Display the input value

OR use:
getline >> (cin, variable-name);
instead of 
cin >> x;
Posted by: Guest on May-01-2020
2

C++ cin cout

int age;
cout << "How old are you ?" << endl;
cin >> age;
Posted by: Guest on May-29-2020
1

cin c++

std::cin >> variable_name; //It takes input from the user
Posted by: Guest on August-17-2021

Browse Popular Code Answers by Language