| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 523 人关注过本帖
标题:[求助]编译有错误可是怎么改呢?
只看楼主 加入收藏
lyle3
Rank: 1
等 级:新手上路
帖 子:80
专家分:0
注 册:2006-5-19
收藏
 问题点数:0 回复次数:3 
[求助]编译有错误可是怎么改呢?

#include "stdio.h"
#include <conio.h>
#include "c.h"
struct student
{

int sequence; //序号
char name[20];
int number;//学号
char sex;
int score[3];
}stu[1000];

void Averone() //Get the average score of one person
{
int a;
printf("Enter the student's number that you want to get the average:");
scanf("%d",&a);
for(int i=0;stu[i].number!=0;i++)
{
if(a==stu[i].number)
{
printf("The student's average score is %d",(stu[i].score[0]+stu[i].score[2]+stu[i].score[3])/3);
return;
}
}
printf("Wrong number!");
return;
}
void Averall() //Get the average of certain subject
{
int a,sum=0;
printf("Enter the subject that you want to get the average:");
scanf("%d",&a);
switch(a)
{
case 1:
{
for(int i=0;stu[i].number!=0;i++)
sum +=stu[i].score[0];
printf("The subject's average is %f",(float)sum/++i);
}break;
case 2:
{
for(int i=0;stu[i].number!=NULL;i++)
sum +=stu[i].score[1];
printf("The subject's average is %f",(float)sum/++i);
}break;
case 3:
{
for(int i=0;stu[i].number!=NULL;i++)
sum +=stu[i].score[2];
printf("The subject's average is %f",(float)sum/++i);
}break;
default:
printf("Dataerror!");
}
printf("press any key to continue.............");
getchar();
return;
}
void found() //Creat
{
int i=0;
printf("*************************** Welcome to use this system! ***********************************");
printf("Press any key to continue.....................................");
getchar();
printf("Enter the student's information at the following order(xuehao xingming xuhao 3ke fen shu ) and use a space to separate each of them:");
printf("Please enter the student's number(enter 0 to exit): ");
scanf("%d",stu[0].number);
do
{
scanf("%d %s %d %d %d %d %d",stu[0].name,stu[i].number,stu[i].sex,stu[i].score[i],stu[i].score[1],stu[i].score[2]);
stu[i].sequence=i+1;
printf("Enter the sex male/female(1/0) ");
scanf("%d",&stu[i].sex);
i++;
printf("Please enter the student's number(enter 0 to exit): ");
scanf("%d",stu[i].number);
}while(stu[i].number);
menu();
}
void menu() //the menu
{
int c;
printf("\t1. Enter the student's information\n\t2.Print the student's information\t\n3.Get the average score\t\n4.Get the highest score\t\n5.exit!");
printf("Enter you choice:");
scanf("%d",&c);
switch(c)
{
case 1:found();break; //Found one record
case 2:menuprint();break; //Print the srudent's information
case 3:menuaver();break; //Get the average score of the student
case 4:menuhigh();break; //Get the highest score of the student
case 5:out(); //Get out the progam
default:
printf("Dataerror!");
}


}
void menuprint() //Print the information
{
int c;
printf("\t1.Print all the students'information\t\n2.Print the information according to the sex\t\n3.Print a certain student's information\t\n4.Scores that all above 80\t\n5.Return");
scanf("%d",&c);
switch(c)
{
case 1:Printall();break; //Print all the students'information
case 2:Printsex();break; //Print the information according to the sex
case 3:Printnumber();break; //Print a certain student's information
case 4:Printscore();break; //Scores that all above 80
case 5:return; //Return
default:
printf("Dataerror!");
}
}
void menuaver()//Get the average score
{
int c;
printf("\t1.Get one subject's average score\t\n2.Get one student's average score\t\n3.Return");
scanf("%c",&c);
switch(c)
{
case 1:Averall();break; //Get one subject's average score
case 2:Averone();break; //Get one srudent's average score
case 3:return; //Return
default:
printf("Dataerror!");
}
}
void menuhigh() //Get the highest score
{
int c;
printf("\t1.Get the highest score of one subject\n\t2.Get the highest score of one's average score\t\n3.Return");
scanf("%d",&c);
switch(c)
{
case 1:searchone();break; //Get the highest score of one subject
case 2:search();break; //Get the highest score of one's average score
case 3:return; //Return
default:
printf("Dataerror!");
}
}
void out()
{
exit(1);
}
void Printall() //Print all the students' scores
{
printf("All the students' scores are:");
for(int i=0;i<1000&&stu[i].number!=0;i++)
printf("%d %d %d %d ",stu[i].sequence,stu[i].score[0],stu[i].score[1],stu[i].score[2]);
}
void Pirntsex() //Print the scores according to the sex
{
int c,i;
printf("Enter the sex male/female(1/0) ");
scanf("%d",&c);
switch(c)
{
case 1:
for(i=0;(i<1000)&&(stu[i].number!=0)&&(stu[i].sex==1);i++)
printf("%d %d %d %d ",stu[i].sequence,stu[i].score[0],stu[i].score[1],stu[i].score[2]);
case 0:
for(i=0;(i<1000)&&(stu[i].number!=0)&&(stu[i].sex==1);i++)
printf("%d %d %d %d ",stu[i].sequence,stu[i].score[0],stu[i].score[1],stu[i].score[2]);
default:
printf("Dataerror!");
}
}
void Printnumber() //Print the scores according to the student's number
{
int c,i;
printf("Enter the student's number:");
scanf("%d",&c);
for(i=0;(i<1000)&&(stu[i].number!=0);i++)
if(stu[i].number==c)
printf("%d %d %d %d ",stu[i].sequence,stu[i].score[0],stu[i].score[1],stu[i].score[2]);
}
void Printscore() //The students all the scores of whom are above 80
{
for(int i=0;(i<1000)&&(stu[i].number!=0);i++)
if((stu[i].score[0]>80)&&(stu[i].score[1]>80)&&(stu[i].score[2]>80))
printf("%d %d %d %d ",stu[i].sequence,stu[i].score[0],stu[i].score[1],stu[i].score[2]);
}
void search() //Get the student's information whose average score is highest of all
{
int i,n;
float max;
max=(float)(stu[0].score[0]+stu[0].score[1]+stu[0].score[2])/3;
for(i=0;i<1000&&stu[i].number!=0;i++)
if((float)(stu[0].score[0]+stu[0].score[1]+stu[0].score[2])/3>max)
n=i;
printf("%d %d %d %d %d",stu[n].sequence,stu[n].number,stu[n].score[0],stu[n].score[1],stu[n].score[2]);
if(stu[n].sex==1)
printf(" sex: male");
else printf(" sex: female");
}
void searchone() //Get the student's information whose certain subject's score is the highest
{
int i,c,max,n;
printf("Enter the subject(0/1/2):");
scanf("%d",&c);
max=stu[0].score[c];
for(i=0;i<1000&&stu[i].number!=0;i++)
if(stu[i].score[c]>max)
n=i;
printf("%d %d %d %d %d",stu[n].sequence,stu[n].number,stu[n].score[0],stu[n].score[1],stu[n].score[2]);
if(stu[n].sex==1)
printf(" sex: male");
else printf(" sex: female");
}
void main() // the main menu
{
menu();
out();
}
编译有错误 可是 怎么改呢?

搜索更多相关主题的帖子: 编译 
2006-06-25 11:59
luo113927
Rank: 1
等 级:新手上路
帖 子:173
专家分:0
注 册:2006-3-15
收藏
得分:0 
路过
2006-06-25 13:10
走刀口→超
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:5018
专家分:0
注 册:2006-3-14
收藏
得分:0 

晕。这么长。错误大概在哪一样也说一下么!


人在江湖【走】,怎能不挨【刀】;为了能活【口】,唯有把己【超】!come on...
2006-06-25 13:18
lyle3
Rank: 1
等 级:新手上路
帖 子:80
专家分:0
注 册:2006-5-19
收藏
得分:0 

错误的信息是这样的
--------------------Configuration: s - Win32 Debug--------------------
Compiling...
s.cpp
Linking...
s.obj : error LNK2001: unresolved external symbol "void __cdecl Printsex(void)" (?Printsex@@YAXXZ)
Debug/s.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

s.exe - 2 error(s), 0 warning(s)
这是在VC 下的编译结果


我将再给你一次选择的机会............... QQ:514897584
2006-06-25 16:46
快速回复:[求助]编译有错误可是怎么改呢?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.039936 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved