// struct4.cpp : 定義控制臺應用程式的入口點。
//
#include "stdafx.h"
#include <cstdlib>
#include <stdio.h>
struct student {
int num;
char name[10];
float score[3];
};
void print(struct student s){
printf("%d %s %f %f %f\n",s.num,s.name,s.score[0],s.score[1],s.score[2]);
}
void input(struct student s){
scanf("%d %s %f %f %f",&s.num,s.name,&s.score[0],&s.score[1],&s.score[2]);
}
int _tmain(int argc, _TCHAR* argv[])
{ struct student s[3];
for(int i=0;i<3;i++){
input(s[i]);
}
for(int j=0;j<3;j++){
print(s[j]);
}
system("pause");
return 0;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/97263.html
標籤:基礎類
