Mega Code Archive
Categories
/
C++
/
File
Use getline() to read a string that contains spaces
#include
#include
using namespace std; int main() { char str[80]; cout << "Enter your name: "; cin.getline(str, 79); cout << str << '\n'; return 0; }