Skip to content

Commit 8e3b5a5

Browse files
Add files via upload
1 parent b6d8405 commit 8e3b5a5

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
}

Practise Programs/117test.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
}

0 commit comments

Comments
 (0)