Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

user input c++

#include <iostream>
int main(){
  std::string firstname; //variable created as a string
  std::cout << "What's your first name
";
  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.
 
PREVIOUS NEXT
Tagged: #user #input
ADD COMMENT
Topic
Name
9+6 =