#include<iostream.h>
#include<string.h>
class Student;
class Teacher
{
private:
int bh;
char name[10];
public:
Teacher(int h,char n[])
{
bh=h;
strcpy(name,n);
}
void display()
{
cout<<"bh:"<<bh<<endl;
cout<<"name:"<<name<<endl;
}
void modify_stu(Student&,float);
};
class Student
{
private:
int id;
float score;
public:
Student(int xh, float s)
{
id=xh;
score=s;
}
void display()
{
cout<<"id:"<<id<<endl;
cout<<"score:"<<score<<endl;
}
friend void Teacher::modify_stu(Student&,float);
};
void Teacher::modify_stu(Student &c,float s)
{
c.score=s;
}
void main()
{
Teacher t1(1000,"王琳");
Student c(1022,67);
c.display();
t1.modify_stu(c,89);
c.display();
}
#include<string.h>
class Student;
class Teacher
{
private:
int bh;
char name[10];
public:
Teacher(int h,char n[])
{
bh=h;
strcpy(name,n);
}
void display()
{
cout<<"bh:"<<bh<<endl;
cout<<"name:"<<name<<endl;
}
void modify_stu(Student&,float);
};
class Student
{
private:
int id;
float score;
public:
Student(int xh, float s)
{
id=xh;
score=s;
}
void display()
{
cout<<"id:"<<id<<endl;
cout<<"score:"<<score<<endl;
}
friend void Teacher::modify_stu(Student&,float);
};
void Teacher::modify_stu(Student &c,float s)
{
c.score=s;
}
void main()
{
Teacher t1(1000,"王琳");
Student c(1022,67);
c.display();
t1.modify_stu(c,89);
c.display();
}