当前位置:网站首页>Pta:7-67 friend is very simple 2016final
Pta:7-67 friend is very simple 2016final
2022-06-23 04:38:00 【Sy_ Faker】
C++ Exam in progress . Please design a student class student, Student number 、 This exam result is its private data member , At the same time, there is a friend function to find the student with the highest score in this exam student* average(student *p,int count)
The above class name and the form of friend function , Must be in accordance with the requirements of the topic , Do not modify .
Input format :
Input is Student number ([00001,99999]) And achievements , With 0 end .( No more than 100 A student )
Output format :
The output is for the students with the highest scores Student number . Tips : If it is tied for the highest score , You need to output the student numbers of the students with the highest scores , Separated by a space .
sample input :
Here's a set of inputs . for example :
10001 90
10002 93
0
sample output :
Here is the corresponding output . for example :
10002
#include<iostream>
using namespace std;
class student
{
private:
int num;
int score;
public:
student(){
;}
void input(int n,int s)
{
num=n;
score=s;
}
friend student* average(student *p,int count);
};
student* average(student *p,int count)
{
int max=0,temp;
for(int i=0;i<count;i++)
{
temp=p[i].score;
max=temp>max?temp:max;
}
int first=1;
for(int i=0;i<count;i++)
{
if(max==p[i].score)
{
if(first)
{
cout<<p[i].num;
first=0;
}
else
cout<<" "<<p[i].num;
}
}
return p;
}
int main()
{
student p[100];
int n,s,i=0;
cin>>n;
while(n!=0)
{
cin>>s;
p[i++].input(n,s);
cin>>n;
}
average(p,i);
}
边栏推荐
- Photoshop PS viewing pixel coordinates, pixel colors, pixel HSB colors
- svg d3. JS generate tree tree view
- [ACNOI2022]不猜不行
- Review the SQL row column conversion, and the performance has been improved
- [binary tree] completeness test of binary tree
- Imitation 360 desktop suspended ball plug-in
- [deep learning] deep learning reasoning framework tensorrt MNN openvino onnxruntime
- Halcon glue line detection - template matching, pose transformation, glue width, glue continuity detection
- How to use MySQL index well
- [multimode] unimo
猜你喜欢

② cocoapods原理及 PodSpec 文件上传操作

抖音x-bogus和_signature参数分析

Mobile terminal city list sorting JS plug-in vertitylist js

Halcon知识:binocular_disparity 知识

众昂矿业:新能源新材料产业链对萤石需求大增

Pytoch --- pytoch customizes the dataset

Software development in 2022: five realities CIOs should know

会话和守护进程

How to use shell script to monitor file changes
![3D数学基础[十六] 匀加速直线运动的公式](/img/51/5b05694bbd0f4fd01dd26cf55b22c7.png)
3D数学基础[十六] 匀加速直线运动的公式
随机推荐
PTA:7-65 饮料的价格
抖音x-bogus和_signature参数分析
深度学习 TensorFlow入门
PTA:7-58 图书音像出租管理
PTA:6-73 函数调用
PTA:7-85 数据的间距问题(重载+函数模板)
12 excellent practices of wireless network security
Inscription of lougu brush
Leetcode 1208. Try to make the strings equal as much as possible (finally solved, good night)
What are the characteristics of SRM supplier management system developed by manufacturing enterprises
Prince language on insect date class
Sequence table lookup
2022年起重机械安全管理考试题库及答案
PTA:7-31 期刊收费
Software development in 2022: five realities CIOs should know
[learn FPGA programming from scratch -40]: Advanced - Design - competition and risk
Pta:7-85 data spacing (overload + function template)
IDEA-导入模块
Online text filter less than specified length tool
PTA: spacing of 7-69 data