学生成绩管理系统出现的错误是missing“;”before type

leisheng110 2014-06-18 10:24:42

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
#define N 100
struct stu{
char number[8];
char name[8];
char sex[2];
int yw,sx,yy,sum;
float ave;
};
void choose();
void creat(struct stu score[],int n);
void add(struct stu score[],int n);
void search(struct stu score[],int n);
void alter(struct stu score[],int n);
void del(struct stu score[],int n);
void sta(struct stu score[],int n);
void sort(struct stu score[],int n);
void print(struct stu score[],int n);
static int m;
void main(){

void choose();
printf("请输入人数:");
scanf("%d",&m);
}
void choose(struct stu score[],int n){
int p;
printf(" 学生成绩管理系统");
printf("1.创建学生的资料 2.追加学生的资料");
printf("3.查询学生的资料 4.修改学生的资料");
printf("5.删除学生的资料 6.统计学生的资料");
printf("7.对学生资料进行排序");
printf("***欢迎进入成绩管理系统,请选择您所要的操作(按任意键退出):");
scanf("%d",&p);
while(p>=1&&p<=7){
switch(p){
case 1:creat(score,n);break;
case 2:add(score,n);break;
case 3:search(score,n);break;
case 4:alter(score,n);break;
case 5:del(score,n);break;
case 6:sta(score,n);break;
case 7:sort(score,n);break;
default :exit(0);
}
printf("请选择您所要的操作:");
scanf("%d",&p);
}
}
void creat(struct stu score[],int n){
int i;
for(i=0;i<m;i++){
printf("请依次输入第%d个学生的学号、姓名、性别、语文、数学、英语、总成绩、平均成绩:\n");
scanf("%c%c%c%d%d%d%f%f",
&score[i].number,&score[i].name,&score[i].sex,&score[i].yw,&score[i].sx,
&score[i].yy,&score[i].sum,&score[i].ave);
}
void add(struct stu score[],int n){
int i;
int q;
printf("要添加的人数:");
scanf("%d",&q);
for(i=0;i<q;i++){
printf("请依次输入要添加的第%d个学生的学号、姓名、性别、语文、数学、英语、总成绩、平均成绩:\n");
scanf("%c%c%c%d%d%d%f%f",
&score[m+i].number,&score[m+i].name,&score[m+i].sex,&score[m+i].yw,&score[m+i].sx,
&score[m+i].yy,&score[m+i].sum,&score[m+i].ave);
m=m+q;
}
}
void search(struct stu score[],int n){
char q;int i;
printf("输入要查询的学生的姓名或学号:");
scanf("%c",&q);
for(i=0;i<m;i++){
if(strcmp(q,score[i].name)==0||strcmp(q,score[i].number)==0)
printf("%c%c%c%d%d%d%f%f",
score[i].number,score[i].name,score[i].sex,score[i].yw,score[i].sx,score[i].yy,score[i].sum,score[i].ave);
}
}
void alter(struct stu score[],int n){
char q;int i;
printf("资料要修改的学生的姓名或学号:");
scanf("%c",&q);
for(i=0;i<m;i++){
if(strcmp(q,score[i].name)==0||strcmp(q,score[i].number)==0){
printf("请重新依序输入该学生资料(学号、姓名、性别、语文、数学、英语、总成绩、平均成绩):");
scanf("%c%c%c%d%d%d%f%f",
&score[i].number,&score[i].name,&score[i].sex,&score[i].yw,&score[i].sx,
&score[i].yy,&score[i].sum,&score[i].ave);
}
}
}
void del(struct stu score[],int n){
char q;
int i,j;
printf("要删除的学生的姓名或学号:");
scanf("%c",&q);
for(i=0;i<m;i++){
if(strcmp(q,score[i].name)==0||strcmp(q,score[i].number)==0){
for(j=i;j<m-1;j++){
score[j].number=score[j+1].number;
score[j].name=score[j+1].name;
score[j].sex=score[j+1].sex;
score[j].yw=score[j+1].yw;
score[j].sx=score[j+1].sx;
score[j].yy=score[j+1].yy;
score[j].sum=score[j+1].sum;
score[j].ave=score[j+1].ave;
}
}
}
void sta(struct stu score[],int n)
{
int i;
for(i=0;i<m;i++)
{
score[i].sum=score[i].yw+score[i].sx+score[i].yy;
score[i].ave=(float)score[i].sum/3;
}
}
void sort(struct stu score[],int n){
int i,j;
struct stu t;
for(i=0;i<m-1;i++){
for(j=i+1;j<m;j++){
if(score[i].ave<score[j].ave)
t=score[i],score[i]=score[j],score[j]=t;
}
}
}

void print(struct stu score[],int n)
{
int i;
for(i=0;i<m;i++)
printf("%c%c%c%d%d%d%f%f",
score[i].number,score[i].name,score[i].sex,score[i].yw,score[i].sx,score[i].yy,score[i].ave);
}



...全文
151 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
blueberryg 2014-06-20
  • 打赏
  • 举报
回复
void del(struct stu score[],int n) 这个函数少了一个“}”
ZTZ2019 2014-06-20
  • 打赏
  • 举报
回复
语法错误的话,先看错误定位,查看上下代码是否有漏括号这类问题 然后如果编译可以,运行不能的话,可以看看头文件顺序是否有问题
rxguoblp 2014-06-19
  • 打赏
  • 举报
回复
missing“;”before type ,找故障定位
野生大猫 2014-06-19
  • 打赏
  • 举报
回复
这是用notepad 写的么~
lx624909677 2014-06-18
  • 打赏
  • 举报
回复
那些都是语法错误,你都不说错误在哪一行怎么给看,自己检查下标点符号吧
sichuanwww 2014-06-18
  • 打赏
  • 举报
回复
基本程序是要自己调试的。
微型蚂蚁 2014-06-18
  • 打赏
  • 举报
回复
void creat(struct stu score[],int n){ int i; for(i=0;i<m;i++){ printf("请依次输入第%d个学生的学号、姓名、性别、语文、数学、英语、总成绩、平均成绩:\n"); scanf("%c%c%c%d%d%d%f%f", &score[i].number,&score[i].name,&score[i].sex,&score[i].yw,&score[i].sx, &score[i].yy,&score[i].sum,&score[i].ave); } 后面少了一个 } 编译错误信息里应该指明了哪一行,如果没有就换一个开发环境吧

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧