你的错误是比不知道C语言的索引是从0开始的么,而不是1,
#include#define n 3struct STUDENT{ char name[20]; char number[10]; int score[3]; int sum;};main(){ int i=0,j=0,max=0,maxi=0; struct STUDENT stu[n]; for(i=0;i<n;i++) { printf("Please input student%d's information
",i+1); printf("Number:"); scanf("%s",stu[i].number); printf("Name:"); scanf("%s",stu[i].name); for(j=0;j<3;j++) { printf("Score[%d]:",j); scanf("%d",&stu[i].score[j]); } } for(i=0;i<n;i++) { for(j=0;j<3;j++) {stu[i].sum+=stu[i].score[j];} if(max<stu[i].sum) { max=stu[i].sum; maxi=i; } } printf("The highest student is student%d:%s %s %d %d %d
",maxi,stu[maxi].number,stu[maxi].name,stu[maxi].score[0],stu[maxi].score[1],stu[maxi].score[2]);}
......... scanf("%d", &n); for(i=0;i<n;i++){ scanf("%d%s",&stu[i].number,stu[i].name);stu[i].sum = 0; //先给sum赋初值,否则它是随机值,影响结果 for(j=0;j<3;j++){ scanf("%d",&stu[i].score[j]); stu[i].sum+=stu[i].score[j]; } } .......
VB输入N个学生的学号和成绩,打印出成绩最高者的学号和成绩
Private Sub Command1_Click()Picture1.AutoRedraw = True If i >= 5 Then MsgBox ("最多只能输入5个学生信息"): Text1.Text = "": Text2.Text = ""Text1.Locked = True: Text2.Locked = True Else If Text1 = "" Or Text2 = "" Then N = MsgBox("请认真填写学生的基本信息",...
输入若干个学生信息(学号、姓名和成绩),输入学号为0时输入结束。建立一...
ptr1->next=ptr2->next;free(ptr2);} else ptr1=ptr2;ptr2=ptr1->next;} return head;} void Ptrint_Stu_Doc(struct stud_node *head){ struct stud_node*ptr;if(head==NULL){ printf("\\nNo Records\\n");return;} for(ptr=head; ptr; ptr=ptr->next)printf("%d %s %d\\n", ...
编写C语言程序处理若干个学生的信息,每个学生的信息包括:学号、姓名...
\/\/这里用来读入学生信息 printf("Pls enter your Info,as :2007 aaa 97 98 99\\n");for(i=0;i<N;i++){ scanf("%ld %s %d %d %d",&stu[i].num,stu[i].name,&stu[i].score[0],&stu[i].score[1],&stu[i].score[2]);} \/\/下面是用来显示输入的用户信息 for(i=0;i<N;i...
...结构体 输入学生个数n。输入这n个学生姓名、学号、五门课成绩。输 ...
printf("Please input the information:\\n") ;\/\/输入学生信息 for(i=0;i<n;i++)\/\/输入姓名(如 bill gates){ scanf("%c",&ch);while(ch!='\\n'){ Ptr[i].name[p]=ch;p++;scanf("%c",&ch);} Ptr[i].name[p+1]=0;scanf("%c",ch);\/\/输入学号(含字母、数字)while(...
已知学生记录由学号和成绩组成,输入n个学生的学号和成绩。找出成绩最高...
要不你试着把printf("%12s%5f\\n",pstu[i]->no,pstu[i]->grade);改成printf("%12s%5lf\\n",pstu[i]->no,pstu[i]->grade);我乱猜的,太长懒得看
c++读入n名学生的姓名、学号、成绩,分别输出成绩最高和成绩最低学生的...
我看了一下你的代码,发现你的思路是:分数在0-100之间且不存在两个相同的分数,于是,用相对应得分数储存数据,而且用一个judge为真假来判断该位置是否被占用。寻找最大的方式是从100往下看,当遇到第一个judge为真的时候就是最大,最小的反之即可。然后,我发现你的错误是:judge[j]=1,应该改为...
C语音编程题(一个班级有N个学生,每个学生有学号、姓名,学生学习课程...
printf("请输入第%d名学生的英语分数:\\n",i+1);if(stu[j].totalScore>stu[j+1].totalScore){ studenttempStu;printf("名次学号姓名语文数学英语总分平均分\\n");for(i=0;i<n;i++)return0;} 简洁的语言 C语言包含的各种控制语句仅有9种,关键字也只有32个,程序的编写要求不严格且以小写...
编写一个c语言程序,实现录入学生学号和姓名信息的功能
include<stdio.h> include<stdlib.h> intmain(void){ chars[10];\/\/姓名 intnum;\/\/学号 printf("请输入姓名:\\n");gets(s);printf("请输学号:\\n");scanf("%d",&num);printf("姓名是:%s\\n学号是:%d\\n",s,num);system("pause");return0;} ...
编写一个c语言程序,实现录入学生学号和姓名信息的功能
1、首先创建一个c语言项目。然后右键头文件,创建一个Stu的头文件。2、然后编写头文件的代码。再将数据结构的增删改查和结构体写入头文件。3、然后在源文件中创建main源文件和Stu源文件。再main文件中写入int mian()代码。4、然后在mian主函数中,写入while语句无限循环。再写入Init函数。5、然后在...
输入若干个学生信息(学号 姓名 成绩) 输入学号为0时输入结束 建立一个...
2、定义两个student类型的变量,保存所有学生的成绩信息和临时变量。3、定义一个自定义函数,输入学生的成绩信息。4、具体实现学生信息的输入,并计算总分。5、主函数中,先定义4个整型变量,保存学生的总数,以及控制循环的变量。6、接着,输入学生总数,保存在变量n中。7、运行程序查看最后结果。注意...