Hi,
I've been programming some examples out of a book and I've noticed something about getline that's made me curious. In the following simple program, you enter a make and model of a car, and then it outputs it.
But say you change the line "cin.getline(make, 19);" to "cin.getline(make, 3);". Then, if you enter something like "ford" or anything longer than that, the program no longer asks you the second question. How come?
Thanks.Code:#include <iostream> using namespace std; char model[20]; char make[20]; int main() { cout << "Enter make: "; cin.getline(make, 19); cout << "Enter model: "; cin.getline(model, 19); cout << make << " " << model; return 0; }