1

来源:互联网 发布:开淘宝店后要怎么操作 编辑:程序博客网 时间:2024/06/08 13:03
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
# difine num 100
typedet struct{
int num;
char name[20];
int english;
int chinese;
int math;
}
int main( )
{
    int key;      //查询关键词
     FILE *fp;
     student stu1[100],stu2[100];
    fp = fopen("student.dic","wb+");  //以输入的方式打开文件
    if(fp==NULL)       //测试是否成功打开
    {
        printf("open error!\n");
        exit(1);
    }
   fwrite{(void*)stu1,sizeof(student),100,fp);
   rewind(fp);
    do
    {


        scanf("%d", key);
        if (key==0)//0000应该加上双引号,否则想结束运行时,不能停止,会认为输入的是一个单词000
            break;
        else
        {


                printf("%s%d%d%d%d",name[key-1]);
        }
    }
    while(1);}

0 0
原创粉丝点击