⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 (2).txt

📁 最后声明
💻 TXT
字号:
#include<iostream>
using namespace std;
class Student{
	char name[10];
	float score;
public:
	Student(char n[],char s)
	{strcpy(name,n);
	score=s;
	}
	char*getname(){return name;}
	friend float compare(Student&S1,Student&S2)
	{
		if(S1.s>S2.s)
			return 1;
		else if(S1.s==S2.s)
			return 0;
		else return -1;
	}
};
void main()
{Student st[]={Student("Lily",90),Student("Lucy",80),Student("Tom",70),Student("Sam",60)};
int i,min=0,max=0;
for(i=0;i<4;i++)
{if(compare(st[max],st[i])==-1)
	max=i;
else if(comepare(st[min],st[i]==1)
		min=i;
}
cout<<"The result is:"<<endl;
cout<<"The highest score is:"<<st[max].getname()<<endl;
cout<<"The lowest score is:"<<st[min].getname()<<endl;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -