Ask Question
24 March, 01:41

Consider the following C code: double balance; try { cout <> balance; cout << endl; if (balance < 1000.00) throw balance; cout << "Leaving the try block." << endl; } catch (double x) { cout << "Current balance: " << x << endl << "Balance must be greater than 1000.00" << endl; } In this code, identify the try block. In this code, identify the catch block. In this code, identify the catch block parameter and its type. In this code, identify the throw statement.

+4
Answers (1)
  1. 24 March, 05:05
    0
    Answer given below

    Explanation:

    Program:

    1. double balance;

    2. try{

    3. cout<<"Enter the balance : ";

    4. cin >> balance;

    5. cout<
    6. if (balance < 1000.00)

    7. throw balance;

    8. cout<<"Leaving the try block."<
    9. }

    10. catch (double x) {

    11. cout<<" Current balance : "<
    12. }

    Answer A:

    If we consider the above program lines, try block represents from 2 to 9 lines.

    Answer B:

    If we consider the above program lines, catch block represents from 10 to 12 lines.

    Answer C:

    catch block parameter is x and its type is double.

    Answer D:

    If we consider the above program lines, line number 7 indicates throw statement.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Consider the following C code: double balance; try { cout balance; cout ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers