Answers for "how to get input in cpp"

C++
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
1

how to input in cpp

int x;
cin >> x;
string s;
cin >> s;
Posted by: Guest on October-03-2021
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

Browse Popular Code Answers by Language