Multiple choice technology programming languages

Which of the following reads in a string named x with one hundred characters?

  1. cin.getline(x, 100, '\n');

  2. cin.getline(100, x, '\n');

  3. readline(x, 100, '\n');

  4. read(x);

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

cin.getline() takes parameters in order: buffer pointer, maximum characters, and delimiter. Option A cin.getline(x, 100, '\n') is correct - x is the character array, 100 is max chars, \n is the delimiter. Option B swaps the first two parameters incorrectly. read() and readline() are not standard C++ functions.