Home » C++ Programming » Basic Input/Output » Question
  1. What is the output of this program?
    #include <iostream>
    using namespace std;
    int main( )
    {
    char line[50];
    cin.getline( line, 50, 'p' );
    cout << line;
    return 0;
    }
    1. 50
    2. p
    3. Compilation Error
    4. It will print what we enter till character p is encountered in the input data
    5. None of these
Correct Option: D

The program will store all strings entered and will print them only when the character ‘p’ is encountered.



Your comments will be displayed only after manual approval.