PROBLEM:Code:#include <iostream.h> #include <conio> using namespace std; int main(){ char array[10]; for (int i = 0; i <= 9; i++){ cout << "Line " << i + 1 << ": "; cin.getline(*(array + i)); //while(cin.get() != '\n'){} //cin.ignore(); //getch(); cout << endl; } cout << endl; for (int i = 0; i <= 9; i++) cout << "Line " << i + 1 << "contains string: " << *(array + i) << endl; return 0; } //end int main
Write a function that accepts ten lines of user-input text and stores the entered lines as ten individual strings. Use a pointer array in your function.
REAL PROBLEM: I can't clear the input buffer correctly. I've tried everything. Cin.getline won't work either