PTA练习题.高考状元
2017-06-26 20:31
204 查看
#include<iostream>
#include<string>
using namespace std;
class student
{
double yuwen;//语文
double math;//数学
double english;//英语
double zong;//综合
public:
string name;
void set(string name1,double yuwen1,double math1,double english1,double zong1)
{
name=name1;
yuwen=yuwen1;
math=math1;
english=english1;
zong=zong1;
}
friend student top(const student *p,int count)
{
double sum=0,tp=0;
int q;
for(int i=0;i<count;i++)
{
tp=p[i].yuwen+p[i].math+p[i].english+p[i].zong;
if(sum<tp)
sum=tp;
}
cout<<sum;
return p[q];
}
};
int main()
{
string name;
double yuwen1;
double math1;
double english1;
double zong1;
double topp;
student a[100];
int i=0;
while(1)
{
cin>>name;
if(name!="0")
{
cin>>yuwen1>>math1>>english1>>zong1;
a[i++].set(name,yuwen1,math1,english1,zong1);
}
else
break;
}
top(a,i);
return 0;
}
#include<string>
using namespace std;
class student
{
double yuwen;//语文
double math;//数学
double english;//英语
double zong;//综合
public:
string name;
void set(string name1,double yuwen1,double math1,double english1,double zong1)
{
name=name1;
yuwen=yuwen1;
math=math1;
english=english1;
zong=zong1;
}
friend student top(const student *p,int count)
{
double sum=0,tp=0;
int q;
for(int i=0;i<count;i++)
{
tp=p[i].yuwen+p[i].math+p[i].english+p[i].zong;
if(sum<tp)
sum=tp;
}
cout<<sum;
return p[q];
}
};
int main()
{
string name;
double yuwen1;
double math1;
double english1;
double zong1;
double topp;
student a[100];
int i=0;
while(1)
{
cin>>name;
if(name!="0")
{
cin>>yuwen1>>math1>>english1>>zong1;
a[i++].set(name,yuwen1,math1,english1,zong1);
}
else
break;
}
top(a,i);
return 0;
}
相关文章推荐
- PTA 计算高考状元
- PTA 计算高考状元
- 为什么停止公布高考状元信息,最着急的是清华北大
- 15位IT大佬的高考:李彦宏是状元 马云数学仅1分
- PTA练习题
- 高考状元学习方法分享:学习三十六计
- 全国68个高考状元,家庭教育方式惊人相似
- PTA练习题---树的同构
- 全国68个高考状元,家庭教育方式惊人相似
- 广东高考放榜划分数线,广州又无总分状元
- 三国时期的“高考状元”都有谁
- 高考状元家长谈如何给孩子减压
- 盘点大佬高考:马云数学考1分 李彦宏系高考状元
- PTA练习题、重要的是说三遍
- 腰斩“状元郎”--海南高考状元刘洋事件思考(zhuan)
- 江苏高考状元在华尔街年薪1亿美元
- 高考状元杀死同学 自称跟马加爵的经历很像
- 1977-1998全国历年高考状元现状
- 2016年全国各省市高考状元详情汇总一览