-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathq32.cpp
51 lines (45 loc) · 1.22 KB
/
q32.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
/* WAP to create a class called Cinema to maintain information about a movie
* and its timings using constructor and destructor. */
#include <iostream>
using namespace std;
class Cinema {
string name;
int releaseyear, duration, showing;
public:
Cinema (string name, int releaseyear, int duration) {
this->name = name;
this->releaseyear = releaseyear;
this->duration = duration;
this->showing = 0;
}
~Cinema () {
showing = 0;
cout << "Movie finished!\n";
}
void start_showing();
void show_details();
};
void Cinema :: start_showing() {
showing = 1;
cout << name << " is now showing!" << endl;
}
void Cinema :: show_details() {
cout << "MOVIE DETAILS" << endl;
cout << "Name: \t\t" << name << endl;
cout << "Year: \t\t" << releaseyear << endl;
cout << "Duration: \t" << duration << " minutes" << endl;
cout << "Showing now: \t";
if (showing) {
cout << "YES" <<endl;
} else {
cout << "NO" << endl;
}
}
int main() {
Cinema movie("Life of Pi", 2013, 78);
movie.show_details();
cout << endl;
movie.start_showing();
cout << endl;
return 0;
}