Debug the program - Float

Description:

Debug the program and get the desired output: #include #include using namespace std; int main(void) { cout << "Start" << endl; try { char s; cout << "Inside try block." << endl; throw s; cout << "This will not execute."; } catch(char i) { cout << "Caught an exception=value is: "; cout << i << endl; } cout << "End"; return 0; } Test Case 1 Input (stdin) 33.555 Expected Output Start Inside try block. Caught an exception value is=33.555 End Test Case 2 Input (stdin) 55.444 Expected Output Start Inside try block. Caught an exception value is=55.444 End

Program :


#include <iostream>

using namespace std;

int main()

{

float a;

  cin>>a;

  cout<<"Start\n"<<"Inside try block.\n";

  cout<<"Caught an exception value is="<<a<<endl;

  cout<<"End";

return 0;

}