Jun 23, 2024
getline functionstring str = "Hello";
char typestring str1 = "Hello";
string str2 = "World";
string result = str1 + " " + str2; // Concatenates with a space
getline Functiongetline(cin, str); string line;
getline(cin, line);
cout << line << endl;
getline reads inputs including spaces until a newline character is encounteredignore() to avoid issues with leftover newline characters in the input buffer