File tree 3 files changed +73
-0
lines changed
3 files changed +73
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ using namespace std ;
3
+
4
+ int main ()
5
+ {
6
+ int age;
7
+ cout << " Enter age for voting:" ;
8
+ cin >> age;
9
+ try
10
+ {
11
+ if (age > 0 && age < 18 )
12
+ {
13
+ throw 0 ;
14
+ }
15
+ else if (age > 120 )
16
+ {
17
+ throw ' v' ;
18
+ }
19
+ else if (age < 0 )
20
+ {
21
+ throw 2.8 ;
22
+ }
23
+ else if (age == 0 )
24
+ {
25
+ throw 0.10 ;
26
+ }
27
+ else
28
+ {
29
+ cout << " Ellegible for voting" ;
30
+ }
31
+ }
32
+ catch (int i)
33
+ {
34
+ cout << " Exception : Not elligible for voting" ;
35
+ }
36
+ catch (...)
37
+ {
38
+ cout << " Exception : Invalid age for voting" ;
39
+ }
40
+
41
+ return 0 ;
42
+ }
Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ #include < fstream>
3
+ using namespace std ;
4
+
5
+ int main ()
6
+ {
7
+ char ch;
8
+ ifstream infile (" stud.txt" );
9
+ ofstream outfile (" BCD.txt" );
10
+ while (infile)
11
+ {
12
+ infile.get (ch);
13
+ outfile.put (ch);
14
+ }
15
+
16
+ return 0 ;
17
+ }
Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ using namespace std ;
3
+
4
+ int main ()
5
+ {
6
+ int x,a;
7
+ x=(a=10 ,a*a);
8
+ cout<<x;
9
+
10
+ int num[]={1 ,2 ,3 ,4 ,5 };
11
+ cout<<num[3 -2 +3 ];
12
+
13
+ return 0 ;
14
+ }
You can’t perform that action at this time.
0 commit comments