Hello-
I am new to C++ and was am working my way through a book and doing the exercises. One of these exercises was to write a program that will get the user to enter a string and then print it back out. I decided to use the cin.getline iostream function to accomplish this. Here is the pertinent code:
Code:
char buffer[30];
cin.getline(buffer, 30, '\n');
for(int i = 0; i < 30; i++)
cout << buffer[i];
However, when I compile and run this program, a blank terminal simply flashes on and then disappears into cybernetic oblivion and I never get a chance to enter input. What did I do wrong?