初学时候的记忆(1)5/24/04 1:28AM

王朝other·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

#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;

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航