-
Notifications
You must be signed in to change notification settings - Fork 0
/
6.9
53 lines (47 loc) · 781 Bytes
/
6.9
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
#include<iostream>
#include<fstream>
#include<cstdlib>
#include<string>
using namespace std;
struct donat
{
string name;
double money;
};
int main()
{
fstream infile;
char filename[20];
cin.getline(filename,20);
infile.open(filename);
if (!infile.is_open())
{
cout << "couldn't open the file" << filename << endl;
cout << "terminated" << endl;
exit(EXIT_FAILURE);
}
int count;
infile >> count;
infile.get();//读取换行符
donat *pa = new donat[count];
for (int i = 0; i < count; i++)
{
getline(infile, pa[i].name);
infile >> pa[i].money;
infile.get();
}
int m = 0;
for (int i = 0; i < count; i++)
{
if(pa[i].money>10000)
{
cout << pa[i].name;
m++;
}
}
if (m == 0)
cout << "none";
delete[]pa;
infile.close();
return 0;
}