Horje
user input c++ Code Example
user input c++
#include <iostream>
int main(){
  std::string firstname; //variable created as a string
  std::cout << "What's your first name\n";
  std::cin >> firstname;//asking for the users' first name
  std:: cout << "Hello " << firstname
}
//Works for anyone, don't need any packages, just type this is in and run it.
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; 
  




8

Related
c++ throw exception Code Example c++ throw exception Code Example
stl for sorting IN C++ Code Example stl for sorting IN C++ Code Example
cpp print vector Code Example cpp print vector Code Example
if vector contains value c++ Code Example if vector contains value c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10