Home » C++ Programming » Basic Input/Output » Question
  1. What is the output of this program?
    #include <iostream>
    #include <ios>
    #include <istream>
    #include <limits>
    using namespace std;
    template <typename CharT>
    void ignore_line ( basic_istream& in )
    {
    in.ignore ( numeric_limits :: max(), in.widen ( '\n' ) );
    }
    int main()
    {
    cout << "First Any Number or String: ";
    cin.get();
    cout << "Clearing cin Data.\n";
    cin.clear();
    ignore_line ( cin );
    cout << "All done Smoothly.\n";
    }
    1. First Any Number or String:
    2. Clearing cin Data.
    3. Compilation Error
    4. Runtime Error
    5. None of these
Correct Option: E

In this program, We are getting the input and clearing all the values.



Your comments will be displayed only after manual approval.