Consider the following code (and assume it is embedded in a complete
and correct program and then run):
char my_string[80];
cout << "Enter a line of input:\n";
cin.getline(my_string, 6);
cout << my_string << "<END OF OUTPUT";
Output:
Enter a line of input:
hello
hello<END OF OUTPUT
Complete program code:
#include <iostream>
using namespace std;
int main()
{
char my_string[80];
cout << "Enter a line of input:\n";
cin.getline(my_string, 6);
cout << my_string << "<END OF OUTPUT";
system("pause");
return 0;
}