标签:c语言
#include<stdio.h>
void main()
{
FILE *fp;long num;int n,score;char name[20]; int N=5;
fp=fopen("d:\\s tu1.txt","w");
for(n=1;n<=N;n++)
{ scanf("%s%10ld%d",name,&num,&score);
fprintf(fp,"%20s%10ld%5d\n",name,num,score);
}
fclose(fp);
fp=fopen("d:\\stu1.txt","r");
for(n=1;n<=N;n++)
{fscanf(fp,"%20s%10ld%5d\n",name,&num,&score);
printf("%20s%10ld%5d\n",name,num,score);
}
fclose(fp);
}
本文出自 “努力奋斗,互相提高” 博客,请务必保留此出处http://c10086.blog.51cto.com/6433044/1413754
编程题:功能:将5个学生记录输入文件d:\stu1.txt中,并且显示在屏幕上。,布布扣,bubuko.com
编程题:功能:将5个学生记录输入文件d:\stu1.txt中,并且显示在屏幕上。
标签:c语言
原文地址:http://c10086.blog.51cto.com/6433044/1413754