-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathex06.cpp
60 lines (50 loc) · 1.27 KB
/
ex06.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
52
53
54
55
56
57
58
59
60
#include <iostream>
#include <string>
struct patrons
{
std::string name;
double contribution;
};
int main()
{
int records = 0;
int noPatrons = 0;
int noGrandPatrons = 0;
std::cout << "Enter the number of contributors: ";
std::cin >> records;
std::cout << std::endl;
patrons *list = new patrons[records];
for (int i = 0; i < records; i++)
{
std::cout << "Enter the name of contributor " << i+1 << ": ";
std::cin.get();
std::getline(std::cin, list[i].name);
std::cout << "Enter the contribution of contributor " << i+1 << ": ";
std::cin >> list[i].contribution;
std::cout << std::endl;
}
std::cout << "\nGrand Patrons\n";
for (int i = 0; i < records; i++)
{
if (list[i].contribution >= 10000)
{
std::cout << list[i].name << std::endl;
noGrandPatrons++;
}
}
if (noGrandPatrons == 0)
std::cout << "none\n";
std::cout << "\nPatrons\n";
for (int i = 0; i < records; i++)
{
if (list[i].contribution < 10000)
{
std::cout << list[i].name << std::endl;
noPatrons++;
}
}
if (noPatrons == 0)
std::cout << "none\n";
delete [] list;
return 0;
}