标签:des blog io os for 数据 sp div c
01 89 02 78 03 56 04 92 05 76
04 92
#include <iostream> #include <algorithm> #include <cstdio> using namespace std; class dd { public: string name; int score; void gete() { cin>>name>>score; } }s[5]; dd max(dd *p, dd *q ) { dd *w; if(q->score > p->score ) { w = p; p = q; q = w; } return *p; } int main() { int i; for(i=0; i<5; i++) { s[i].gete(); } dd *t; t=&s[0]; for(i=1; i<5; i++) { dd *bomb; bomb = &s[i]; *t = max(t, bomb); } cout<<t->name<<‘ ‘<<t->score<<endl; return 0; }
标签:des blog io os for 数据 sp div c
原文地址:http://www.cnblogs.com/yspworld/p/4006011.html