-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstruct-2.cpp
More file actions
61 lines (47 loc) · 1.38 KB
/
struct-2.cpp
File metadata and controls
61 lines (47 loc) · 1.38 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
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
struct Church
{
string name;
string address;
string city;
string pastor;
};
void showChurch(Church*);
int main()
{
const int NO_OF_CHURCHES = 5;
Church churches[NO_OF_CHURCHES];
int church_count;
for (int count = 0; count < NO_OF_CHURCHES; count++)
{
cout << "Enter Church " << count + 1 << " name: ";
getline(cin, churches[count].name);
cout << "Enter Church " << count + 1 << " address: ";
getline(cin, churches[count].address);
cout << "Enter Church " << count + 1 << " city: ";
getline(cin, churches[count].city);
cout << "Enter Church " << count + 1 << " pastor's name: ";
getline(cin, churches[count].pastor);
cout << "\n\n";
}
for (int count = 0; count < NO_OF_CHURCHES; count++)
{
cout << "\n";
cout << "Details for Church " << count + 1<< endl;
cout << "-----------------" << endl;
showChurch(&churches[count]);
cout << "\n";
}
cout << "End of program. Bye." << endl;
return 0;
}
void showChurch(Church *church)
{
cout << "Church name: " << church->name << endl;
cout << "Church address: " << church->address << endl;
cout << "Church city: " << church->city << endl;
cout << "Church pastor: " << church->pastor << endl;
}