大佬们帮忙看一下C语言编译时出现的这个问题

C:\Users\67332\AppData\Local\Temp\ccWMJLH3.o:StudentSystem.c:(.text+0x1b): undefined reference to print'
C:\Users\67332\AppData\Local\Temp\ccWMJLH3.o:StudentSystem.c:(.text+0xf3): undefined reference toStatistical'
collect2.exe: error: ld returned 1 exit status

1个回答

#include"stdio.h"
//函数名
void Student();
void Sum();
void Down();
void Up();
void IDUp();
void Search();
void Statistical();
void Statistic();
void List();
//变量
int score[30],n;
long StudentID[30];
long sum=0;
float average;
void Choose();
main()
{
//选择功能
Choose();
print("bye,bye");
getch();
}
void Choose()
{
int i;
//输入学生学号和成绩v
printf("1.Input record\n");
//输出总分和平均分v
printf("2.Caculate tolal and average score of course\n");
//按分数降幂排序v
printf("3.Sort in descending order by score\n");
//按分数升幂排序v
printf("4.Sort in ascending order by score\n");
//按学号升幂排序v
printf("5.Sort in ascending order by number\n");
//按编号搜索v
printf("6.Search by number\n");
//统计分析
printf("7.Statistic analysis\n");
//清单记录:输出学号、成绩,以及总分以及百分比
printf("8.List recore\n");
//退出系统
printf("0.Exit\n");
printf("Please enter your choice\n");
scanf("%d",&i);
switch(i)
{
case 1:Student();
break;
case 2:Sum();
break;
case 3:Down();
break;
case 4:Up();
break;
case 5:IDUp();
break;
case 6:Search();
break;
case 7:Statistical();
break;
case 8:List();
break;
case 0:break;
}
}
void Student()
{
int i = -1;
do{
i++;
printf("Input StudentID[%d]",i);
scanf("%d",&StudentID[i]);
printf("Input score[%d]",i);
scanf("%d",&score[i]);
}while(score[i]>0);
n=i;
main();
}
void Sum()
{
int i = 0;
for(;i {
sum+=score[i];
}
printf("SUM is %ld\n",sum);
average=sum/n;
printf("The average is %f",average);
main();
}
void Down()
{
char q;
int i,j,s;
long t;
for(i=0;i {
for(j=0;j {
if(score[j]>score[i])
{
s=score[i];
score[i]=score[j];
score[j]=s;
t=StudentID[i];
StudentID[i]=StudentID[j];
StudentID[j]=t;
}
}
}
//询问是否输出数据
printf("Output date or not(Y&N)");
scanf("%c",&q);
if(q=='Y')
{
for(i=0;i {
printf("%ld\t",StudentID[i]);
printf("%d\n",score[i]);
main();
}
}
else main();
}
void Up()
{
char q;
int i,j,s;
long t;
for(i=0;i {
for(j=0;j {
if(score[j] {
s=score[i];
score[i]=score[j];
score[j]=s;
t=StudentID[i];
StudentID[i]=StudentID[j];
StudentID[j]=t;
}
}
}
//询问是否输出数据
printf("Output date or not(Y&N)");
scanf("%c",&q);
if(q=='Y')
{
for(i=0;i {
printf("%ld\t",StudentID[i]);
printf("%d\n",score[i]);
main();
}
}
else main();
}
void IDUp()
{
char q;
int i,j,s;
long t;
for(i=0;i {
for(j=0;j {
if(StudentID[j] {
s=score[i];
score[i]=score[j];
score[j]=s;
t=StudentID[i];
StudentID[i]=StudentID[j];
StudentID[j]=t;
}
}
}
//询问是否输出数据
printf("Output date or not(Y&N)");
scanf("%c",&q);
if(q=='Y')
{
for(i=0;i {
printf("%ld\t",StudentID[i]);
printf("%d\n",score[i]);
main();
}
}
else main();
}
void Search()
{
int low = 0, high = n - 1, mid;
long s;
printf("Input StudentID:");
scanf("%ld",&s);
while(low {
mid=(high+low)/2;
if (s>StudentID[mid])
{
low=mid+1;
}
else if(s {
high=mid-1;
}
else printf("%ld\t%d\n",StudentID[mid],score[mid]);
}
main();
}
void Statistic()
{
int i = 0;
int a=0,b=0,c=0,d=0,e=0;
float A,B,C,D,E;
for(;i {
if(score[i]>89) a++;
else if(score[i>79]) b++;
else if(score[i>69]) c++;
else if(score[i>59]) d++;
else e++;
}
A=a/n;
B=b/n;
C=c/n;
D=d/n;
E=e/n;
printf("A=%d\t%f%%\n",a,A);
printf("B=%d\t%f%%\n",b,B);
printf("C=%d\t%f%%\n",c,C);
printf("D=%d\t%f%%\n",d,D);
printf("E=%d\t%f%%\n",e,E);
main();
}
void List()
{
int i=0;
for(;i<n;i++)
{
printf("StudentID\tscore\n");
printf("%ld\t%d",StudentID[i],score[i]);
Sum();
}
main();
}

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问