-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExchd.cpp
51 lines (49 loc) · 995 Bytes
/
Exchd.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include<iostream>
using namespace std;
void name(){
cout<<'Author: Varun Gupta'<<endl;
}
void Excep(int x)
{
try
{
if (x==1)
{
throw x;
}
else if(x==0)
{
throw x; //character
}
}
catch(int c)
{
cout<<"This is from integer :"<<c<<endl;
}
}
int main(){
name();
// int num1,num2,result;
// cout<<"Enter the 2 values :"<<endl;
// cin>>num1>>num2;
// try
// {
// if(num2==0)
// {
// throw num2;
// }
// result=num1/num2;
// }
// catch(int i)
// {
// cout<<"Exception: Divion by zero is not allowed :"<<i<<endl;
// }
// cout<<"The result is :"<<result<<endl;
// cout<<"This will call the exception :"<<endl;
// Excep(0);"
string s;
cout<<"Enter the elements of the string :"<<endl;
cin>>s;
cout<<"The length of the string is :"<<s.length()<<endl;
return 0;
}