## CSDN博客

### 初学时候的记忆（1）5/24/04 1:28AM

#include <iostream>
using namespace std;

struct stu{
char a[20];
double k;
};

main()
{
int r,i,w,u;
w = 0,u = 0;
cout <<"Please the importation number:/n";//输入捐款人数
cin >> i;
stu* ps = new stu[i];
for(r = 0;r < i;r++)
{
cout << "name:/n";
cin.get();
cin.get((*ps).a,20); //输入捐款人名字
cout << "money:/n";
cin >> (*ps).k;  // 输入捐款人的款数
ps++;
}
ps = ps - i;
cout << "The importance contributes money the person:/n";//重要捐款人
for(r = 0;r < i; r++)
{

if ((*ps).k > 10000)//如果捐款人款数多于10000那就是重要捐款人
{

cout << "name:/n";
cout << (*ps).a << "/n";
cout << "Number:/n";//款数
cout << (*ps).k << "/n";
w++;
ps=ps + 1;
}
ps = ps - w;
cout << "It is other to contribute money the person:/n";//其他捐款人
for(r = 0;r < i; r++)

{
cout << "name:/n";
cout << (*ps).a << "/n";
cout << "Number:/n";//款数
cout << (*ps).k << "/n";
u++;
ps=ps + 1;
}
}
if (w == 0)
{
cout << "The importance contributes money the person:/n";//如果用户输入没有重要捐款人输出NONE
cout << "none";
}
if (u == 0)
{
cout << "It is other to contribute money the person:/n";//如果用户输入没有其它捐款人输出NONE
cout << "none";
}
int q;
cin >> q;
delete [] ps;

return 0;
}

0 0