- 注册时间
- 2004-10-13
- 最后登录
- 2019-5-15
⑧专业
*永恒国度*
- 积分
- 14145

|
程序作用: 当系统提问时回答“E”或“e"输入新的记录,回答“L”或"l"时输出已有数据
- #include"stdlib.h"
- #include"stdio.h"
- struct stud_type
- {
- char name[20];
- long num;
- int age;
- char sex;
- float score;
- }student[30];
- int n=0;
- main()
- {
- char ch;
- int flag=1;
- while(flag)
- {
- printf("\n type 'E'or'e' to enter new record,");
- printf("type 'L' or 'l' to list all records:");
- ch=getchar();getchar();
- switch(ch)
- {
- case 'e':
- case 'E':new_record();break;
- case 'l':
- case 'L':install();break;
- default: flag=0;
- }
- }
- }
- new_record(void)
- {
- char numstr[20];
- printf("\n record %d:\n enter name:",n+1);
- gets(student[n].name);
- printf("\n enter number:");
- gets(numstr);
- student[n].num=atol(numstr);
- printf("\n enter age:");
- gets(numstr);
- student[n].age=atoi(numstr);
- printf("\n enter sex:");
- student[n].sex=getchar();getchar();
- printf("\n enter score:");
- gets(numstr);
- student[n].score=atof(numstr);
- n++;
- }
- listlall(void)
- {
- int i;
- if(n<1)
- printf("\n empty list.\n");
- for(i=0;i<n;i++)
- {
- printf("\nrecord number %d\n",i+1);
- printf("name:%s\n",student[i].name);
- printf("num:%ld\n",student[i].num);
- printf("age:%d\n",student[i].age);
- printf("sex:%c\n",student[i].sex);
- printf("score:%6.2f\n",student[i].score);
- }
- }
复制代码
为什么运行不了呢,要怎么修改才可运行呢?
它的提示错误说明:undefined symbol '_install' in module NONAME.C |
|