Home » C++ Programming » Questions and Answers » Question
  1. What is the output of this program?
    #include 
    #include
    using namespace std;
    int main ()
    {
    try {
    double val1, val2;
    istream_iterator eos;
    istream_iterator iit (cin);
    if (iit != eos)
    val1 = *iit;
    iit++;
    if (iit != eos)
    val2 = *iit;
    cout << (val1 * val2) << endl;
    }
    catch (...) {
    cout << "Unknown exception: " << endl;
    }
    return 0;
    }
    1. Compilation Error
    2. Runtime Error
    3. Garbage Value
    4. It will print the multiplied value of the input
    5. Exception
Correct Option: D

In this program, We got the input by using istream iterator and we are manipulating in.



Your comments will be displayed only after manual approval.