1 #include <iostream>
 2 #include <string.h>
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using namespace std;
 5 struct Student
 6 {
 7     int num;
 8     string name;
 9     float score[3];
10 };
11 
12 int main(int argc, char** argv) {
13     void print(Student);
14     Student stu;
15     stu.num=234;
16     stu.name="Li Fung";
17     stu.score[0]=77.8;
18     stu.score[1]=64;
19     stu.score[2]=98.3;
20     print(stu);
21     return 0;
22 }
23 
24 void print(Student stu)
25 {
26     cout <<stu.num<<" "<<stu.name<<" "<<stu.score[0]<<" "
27     <<stu.score[1]<<" "<<stu.score[2]<<endl;
28 }

 

转载于:https://www.cnblogs.com/borter/p/9401792.html

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐