酷我音乐盒 画屏

来源:百度知道 编辑:UC知道 时间:2024/05/15 18:16:15
为什么我的酷我音乐盒会画屏啊

呵呵,满意的话要给我追加分哦!那两个例子都是我自己给你写的。
1.
#include"stdio.h"
#include"stdlib.h"
main()
{
FILE *fp;
char s[100];
if((fp=fopen("f:\\score.txt","a"))==NULL)
{
printf("Can't open destination file!\n");
exit(0);
}
printf("Please input your name:");
gets(s);
fprintf(fp,"Name:%s\t\tScore:%d\n",s,rand()%100);
fclose(fp);
printf("Your score is saved!\n");
}

2.
#include"stdio.h"
#define N 20
struct score
{
char s[20];
int a;
}d[N];
main()
{
FILE *fp;
int i,no=0;
if((fp=fopen("f:\\score.txt","r"))==NULL)
{
printf("Can't open destination file!\n");
exit(0);
}
for(i=0;i<N&&!feof(fp);i++)
{
fscanf(fp,"Name:%s\t\tScore:%d\n"