repl.it
@videlais/

Using C++: Part 1: Console Input and Output

C++

No description

fork
loading
Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <string>

using namespace std;

int main() {
  // Create a String called "name"
  string name;
  
  // Use cout to display prompt
  cout << "Please enter your name: ";

  // Use getline() to get spaces
  getline (cin, name);
  
  // Show the result
  cout << "Your name is: " << name << endl;
}