CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// code for question answer section.
//https://www.sololearn.com/Discuss/1599728/?ref=app
#include <iostream>
using namespace std;
int main()
{
int choice;
try
{
cout<<"Enter your choice: \n";
cin>>choice;
if(choice == 0)
{
cout<< "You have entered zero!"<<endl;
}
else if(choice == 1)
{
throw (100);//throw integer
}
else if(choice == 2)
{
throw ('x');//throw character value
}
else if(choice == 3)
{
throw (1.23f);//throw float value
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run