createscore.c

来自「一个C做的蛇蛇游戏阿」· C语言 代码 · 共 32 行

C
32 行
字号
/******************************************/
/*       createscore.c of goldenbugs      */
/*                                        */
/*       to create the data highscore     */
/*                                        */
/*           Cat Tom 5.4.2003             */
/******************************************/


#include<stdio.h>

main()
{
 int i;
 FILE *fp;
 char *name[10]={"Cat Tom","Jv29","Little Tiger","Cat Tom","Cat Tom","Cat Tom","Cat Tom","Cat Tom","Cat Tom","Cat Tom"};
 long score[10]={539807,529847,235957,0,0,0,0,0,0,0};

 if((fp=fopen("highscore.set","wb"))==NULL)
 {
  printf("score file open error!!!");
  exit(0);
 }

 for(i=0;i<10;i++)
 {
  fwrite(name[i],sizeof(char),16,fp);
  fwrite(score+i,sizeof(long),1,fp);
 }
 fclose(fp);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?