- #include<iostream>
- #include<string>
- using namespace std;
- class student
- {
- public:
- student (string name1,double score1)
- {
- score=score1;
- name=name1;
- }
- void show1()
- private:
- string name;
- double score;
- };
- void student:: show1()
- {
- cout<<name<<" "<<score<<endl;
- }
- void show(student q)
- {
- q.show1();
- }
- int main()
- {
- student stu[6]={student("伍颖妍",88),student("李晨",88),student("郑凯",99),student("李钟硕",100),
- student("邓超",99),student("王祖蓝",98)};
- for(int i=1;i<6;i+=2)
- {
- show(stu[i]);
- }
- return 0;
- }
4.17【作业】
最新推荐文章于 2024-05-27 00:11:36 发布