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 }
所有评论(0)