example1_basic_usage_with_std_cin.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#include <iostream>
#include <string>

int main() {
    std::string input;
    std::cout << "Enter a line of text: ";
    std::getline(std::cin, input);
    std::cout << "You entered: " << input << std::endl;
    return 0;
}
Back to std_getline