#include<stdio.h>#include<stdlib.h>#include<string.h>struct person{ int num; char name[100]; float basic; float zhiwugongzi; float jintie; float yiliaobaoxian; float gongjijin; float sum;}per[100]={{01,"张望",1286,947,198,109,135,2034},{02,"李明",1185,628,135,94,114,1740},{03,"王小民",895,438,98,64,73,1294},{04,"张效益"1350,868,210,116,150,2162}};int main(){ FILE *fp; int i,n,q,w; char ch; if((fp=fopen("file","w"))==NULL) { printf("can not open this"); exit(0); } for(i=0;i<=3;i++) { fwrite(&per[i],sizeof(struct person),1,fp); } fclose(fp); return 0;}
添加回答
举报
0/150
提交
取消