NEFU C++课程实验三(锐格)

前言:仅供大家参考,有错误大家可以指出。

5350、

#include
#include
using namespace std;
class Hotel{
    int num;
    string name;
    static int total;
public :
    Hotel(int num,string name){
        this->num=num;
        this->name=name;
        total++;
    }
    string get(){
        return this->name;
    }
    void show(){
        cout<<"input guest name query: "<>name;
    if(strcmp(name.c_str(),h1.get().c_str())==0){
        h1.show();
    }
    if(strcmp(name.c_str(),h2.get().c_str())==0){
        h2.show();
    }
    if(strcmp(name.c_str(),h3.get().c_str())==0){
        h3.show();
    }
}

 5351、

#include
using namespace std;
// // 编写程序,统计歌手大奖赛的参赛人数,每名选手的平均得分。
// 要求依次输入选手的编号、姓名、各评委的打分
// // ;输入参赛总人数,并按平均得分由高到低的顺序输出每位选手的
// 名次、姓名、平均得分
class player{
    int num;
    string name;
    int grade1,grade2,grade3;
public:
    
    void set(int num,string name,int grade1,int grade2,int grade3){
        this->num=num;
        this->name=name;
        this->grade1=grade1;
        this->grade2=grade2;
        this->grade3=grade3;
    }
    player(){
    }
    int average(){
        return (grade1+grade2+grade3)/3;
    }
    void show(){
        cout<>n;
    player play[n],play1[n];
    player p;
    for(int i=0;i>num;
        cin>>name;
        cin>>grade1>>grade2>>grade3;
        play[i].set(num,name,grade1,grade2,grade3);
        // play1[i].set(num,name,grade1,grade2,grade3);
    }
    for(int i=0;i

5358、

#include
using namespace std;
class number{
    double  x,y;
public:
    friend void square(number &n){
        cin>>n.x>>n.y;
        cout<

 5359、

#include
using namespace std;
class student{
    string name;
    int sorce;
public:
    friend void search(student s[]){
        student s1;
        for(int i=0;i<9;i++){
            for(int j=0;j<9;j++){
                if(s[j].sorce#include
#include
using namespace std;
class point{
    int x,y;
public:
    friend void distance(point p1,point p2){
        cout<x=x;
        this->y=y;
    }
};
int main(){ 
    int x1,y1,x2,y2;
    cin>>x1>>y1;
    cin>>x2>>y2;
    point p1(x1,y1);
    point p2(x2,y2);
    distance(p1,p2);
}

你可能感兴趣的:(C++,C++)