-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
103 lines (80 loc) · 1.75 KB
/
Main.cpp
File metadata and controls
103 lines (80 loc) · 1.75 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include "Main.h"
#include <iostream>
#include <string>
using namespace std;
void soundMake(BaseAnimal* animal)
{
animal->makeSound();
animal->makeSound();
animal->makeSound();
}
int main()
{
cout << "* * * * * * * * * * * * * * *" << endl;
cout << "* *" << endl;
cout << "* C++ Tutorials *" << endl;
cout << "* *" << endl;
cout << "* * * * * * * * * * * * * * *" << endl;
cout << endl;
Cat ceviz;
ceviz.setName("ceviz");
ceviz.setFood("whiskas");
ceviz.setSleepHour(1);
ceviz.getFeed(ceviz.getFood());
ceviz.sleep(ceviz.getSleepHour());
ceviz.CatchMouse();
cout << endl;
Dog::showDogCount();
Dog karabas;
Dog::showDogCount();
karabas.setName("karabas");
karabas.setFood("kemik");
karabas.setSleepHour(2);
karabas.getFeed(karabas.getFood());
karabas.sleep(karabas.getSleepHour());
karabas.Bark();
Dog* myDog = new Dog();
Dog::showDogCount();
myDog->setName("comar");
delete myDog;
Dog::showDogCount();
cout << endl;
soundMake(&karabas);
cout << endl;
soundMake(&ceviz);
cout << endl;
Bird yildiz;
yildiz.setName("yildiz");
yildiz.setFood("corn");
yildiz.setSleepHour(3);
yildiz.getFeed(yildiz.getFood());
yildiz.sleep(yildiz.getSleepHour());
yildiz.Sing();
yildiz.Fly();
cout << endl;
try
{
int x;
cout << "Enter a value for x: ";
cin >> x;
if (x < 0)
{
throw Error("Error Message No:1");
}
else if (x == 0)
{
throw 101;
}
cout << "end of try-catch block... x: " << x << endl;
}
catch (Error err)
{
cout << "Error is thrown! Special Error Message is : " << err.getErrorMessage() << endl;
}
catch (int errorCode)
{
cout << "Error is thrown! Special Error Message is : " << errorCode << endl;
}
cout << endl;
return 0;
}