c++ cin string code example
Example 1: how to print a string to console in c++
// Just some basic format
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout << "Print a String" << endl;
}
Example 2: input a string in c++
string fullName;
cout << "Type your full name: ";
getline (cin, fullName);
cout << "Your name is: " << fullName;
Example 3: get data from terminal c++
int i;
cout << "Please enter an integer value: ";
cin >> i;