输入一个班10个学生的学号和每个学生考试三门功课(数学、英语、计算机基础)的成绩。

作者&投稿:右生 (若有异议请与网页底部的电邮联系)
急求!!C语言程序:输入一个班10个学生的学号和每个学生考试三门功课(数学、英语、计算机基础)的成绩。~

#include
#include
using namespace std;

class Stu
{

int number;
char name[20];
double math;
double english;
double computer;
public:
Stu(int x,double b1,double b2,double b3,char *p)
{
number=x;
strcpy(name,p);
math=b1;
english=b2;
computer=b3;

};
double sum();
double average();
void print();
int get_reg_num();
void get_stu_inf();

};
double Stu::sum()
{
return(math+english+computer);

}

double Stu::average()
{ double n;
n=(math+english+computer)/3;
return(n);
}

void Stu::print()
{
cout<<"学号"<<''<<"姓名"<<''<<" 数学成绩"<<''<<" 英语成绩"<<''<<"计算机成绩"<<endl;
cout<<number<<''<<name<<''<<''<<math<<''<<''<<english<<''<<''<<computer<<endl;

}
int Stu::get_reg_num()
{
return(number);

}
void Stu::get_stu_inf()
{
cout<<"请输入学生名称";
cin>>name;
cout<<"请输入学生学号";
cin>>number;
cout<<"请输入学生数学成绩";
cin>>math;
cout<<"请输入学生英语成绩";
cin>>english;
cout<<"请输入学生计算机成绩";
cin>>computer;

}
int main()
{
int i,number,c=0;
double s=0;
double y=0;
Stu a[3]={Stu(3450,85,75,65,"yang"),Stu(3440,85,75,65,"hehe"),Stu(3450,85,75,65,"hei")};
for(i=0;i<3;i++)
{
a[i].print();
}
for(i=0;i<3;i++)
{
s=s+a[i].average();
y=y+a[i].sum();
cout<<a[i].get_reg_num()<<endl;
cout<<"平均成绩";
cout<<a[i].average()<<endl;
cout<<"总成绩";
cout<<a[i].sum()<<endl;


}
cout<<"全班总分"<<s<<endl;
cout<<"全班平均成绩"<<y/3<<endl;
cout<<"请输入要查询的学号";
cin>>number;
for(i=0;i<3;i++)
{
if(number==a[i].get_reg_num())
{
a[i].print();
c++;

}
}
if(c==0)
cout<<"没有找到相关学生信息";
system("pause");
return 0;



}


这是以前写的一段代码,自己改下吧

同学,我是你们c++课程的韩虎老师,c++课设务必自己动手完成,借助其他渠道完成作业者一律取消成绩! 重视中国高校教育,从我做起,请赞。

我的已经算出他们的平均数了,你看行不行啊~
struct students
{
char num[7];
char name[20];
int scores[3];
float ave;
float max;
};
main()
{
struct students stu[4];
int m,n,i=0;
float sum,max=0;
for(m=0;m<4;m++)
{
printf("input the No:%d student's:\n",m+1);
printf("school_num name:\n");
scanf("%s%s",stu[m].num,stu[m].name);
printf("Scores of subject:\n");
for(n=0;n<3;n++)
{
scanf("%d",&stu[m].scores[n]);
}
}
for(m=0;m<4;m++)
{
sum=0;
for(n=0;n<3;n++)
{
sum+=stu[m].scores[n];
stu[m].ave=sum/3.0;
}
printf("%s'saverage is %5.2f.\n",stu[m].name,stu[m].ave);
}
for(m=0;m<4;m++)
{
if(stu[m].ave>max)
{
max=stu[m].ave;
i=m;
}
printf("%s %s's the max is %5.2f.\n",stu[i].num,stu[i].name,stu[i].ave);
}
for(n=0;n<3;n++)
{
printf("%-4d",stu[i].scores[n]);

不清楚你要问的是什么,是表格吗?


C语言已知一个班10名同学的成绩,存放在一个一维的数组中,要求找出其 ...
include <stdio.h> void main(){ int j,i,score[11],t,t2;printf("请输入10个学生的成绩:\\n");for(i=1;i<=10;i++)scanf("%d",&score[i]);t=score[1];t2=1;for(i=1;i<=9;i++)if(score[i]>t){ t=score[i];t2=i;} printf("最高分是:%d\\t该生学号是:%d\\n",...

中专一般一个班多少个学生?
中专就跟高中一样,一个班多少人得看学校。如果比较火的专一个班40来人是可以的一些不咋样的的中专一个班30来人也很正常。

一个班级几十个学生,谁能拿到奖状?
到底是谁能拿这些荣誉奖励呢?根据平时经验,德智体美劳全面发展者、某一科目成绩优秀、遵守纪律者、教师班级管理得力助手者等等优先获得。可以说,这类荣誉奖励多是由学生学习成绩,以及平时表现来拿到。至于拿什么样的荣誉奖励,看学生的哪一方面比较突出。二,决定给谁拿的又是谁?一个班级几十个学生,...

对于一个成绩稳定在班级前10名的学生,初二语文,数学,英语,物理难吗...
以我个人的经验,初中的这几科还是很基础的,如果初一成绩尚可,数语外应该没有什么意外的难度。但倒是见过一些同学对初学的物理有些不太适应。个人观点,初中物理还是很简单的,要有兴趣去学习,不要被别人的评价吓到,课堂是最重要的(自己都不用额外买练习册哦,好像初中老师都很喜欢给学生订练习册...

求“已知一个班10个学生的成绩,要求输入这10个学生的成绩,然后求出它们...
\/\/ Test1.cpp : Defines the entry point for the console application.\/\/#include "stdafx.h"include <stdio.h> int main(int argc, char* argv[]){ \/\/已知一个班10个学生的成绩,要求输入这10个学生的成绩,然后求出它们的平均成绩。int StudentNumber = 10;int count = 1;float Score =...

暑假辅导机构一般一个班3,4年级的学生大约多少
6到10个孩子。暑假辅导机构是临时补课班,一般一个班3、4年级的学生是6到10人,人数少是为了保质保量辅导孩子完成课程。辅导班是以提高成绩为目的一个课外辅导机构。

已知一个班10个同学的成绩,要求输入这10个学生的成绩,然后求出它们的平...
Students[10]float sum=0,aver=0 for(i=0;i<10;i++) { printf("请输入学号为%d",i+1); printf("的学生的成绩:"); scanf("%f",&Students[i]); } for(j=0;j<10;j++) sum=sum+Students[j]; aver=sum\/10; printf("这几个同学的平均成绩为:%.2f\\n",aver); } ...

一个班有20个学生,每个学生的数据包括学号,姓名,性别,年龄和四门功课...
我用C++编写的 include<iostream> include<string> using namespace std;struct student { int num;string name;string sex;double score[5];}stu[21];int main(){ int number;cout<<"请输入学生的信息\\n";for(int i=1;i<21;i++){ for(int j=1;j<5;j++)cin>>stu[i].num>>stu[i...

现有一个班级,共10人,本学期共学习三门课程,设计一个学生成绩管理系统...
现有一个班级,共10人,本学期共学习三门课程,设计一个学生成绩管理系统,要求如下:1、完成三门课程成绩输入;或单门课程录入、或同时录入三门课。2、完成成绩排序:按单科成绩排序... 现有一个班级,共10人,本学期共学习三门课程,设计一个学生成绩管理系统,要求如下:1、完成三门课程成绩输入;或单门课程录入、或...

你认为一个班级最好有多少学生才能有利于师生互动?
我觉得班级有三十个学生是最容易有利于和老师互动的,因为学生不多不少,老师还是挺容易都照顾到的。

耿马傣族佤族自治县13351813273: 用C语言编写程序:从键盘输入一个班10个学生的学号和每个学生考试三门功课. -
衅才儿童: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46structstudents {charnum[7];charname[20];intscores[3];floatave;floatmax; }; main(){structstudents stu[4];...

耿马傣族佤族自治县13351813273: 急求!!C语言程序:输入一个班10个学生的学号和每个学生考试三门功课(数学、英语、计算机基础)的成绩. -
衅才儿童: #include <string.h>#include<iostream> using namespace std; class Stu { int number; char name[20]; double math; double english; double computer; public: Stu(int x,double b1,double b2,double b3,char *p) { number=x; strcpy(name,p); math=b1; ...

耿马傣族佤族自治县13351813273: 我们老师给我们布置了一个编程题:输入一个班10个学生的学号和每个学生考试三门功课(数学,英语,计算机)的成绩,编程计算出每个学生的总分和平均分·,并按学生成绩优劣排序·最后打印一张按高分到低分· -
衅才儿童: #include struct student { int num;//学号 char name[20];//姓名 float chengji1,chengji2,chengji3;//成绩 float avg;//平均成绩 } ; void display(struct student stu[],int count); void paixu(struct student stu[],int count); int charu(struct student stu[],int count...

耿马傣族佤族自治县13351813273: 输入一个班10个学生的学号和每个学生考试三门功课(数学、英语、计算机基础)的成绩. -
衅才儿童: 我的已经算出他们的平均数了,你看行不行啊~ struct students { char num[7]; char name[20]; int scores[3]; float ave; float max; }; main() { struct students stu[4]; int m,n,i=0; float sum,max=0; for(m=0;m<4;m++) { printf("input the No:%d student's:\n",...

耿马傣族佤族自治县13351813273: C语言高手来~ -
衅才儿童: int a[10],b[10],c[10],e[10],x[10],y; for(i=1;i<=10;i++){ scanf("%d,%e,%f",&a[i], x[i]=a[i]+b[i]+c[i]; } for(i=1;i<=10;i++){ for(j=10;j<=i;j--){ if x[j]>...

耿马傣族佤族自治县13351813273: 帮忙用C语言编程:有10个学生,每个学生数据包括学号,姓名,四门课的成绩,从键盘输入10个学生的数据记录 -
衅才儿童: 这个容易哦,不过分太少了. 因为分太少,所以偷了点懒.按E和按F键的功能,我没有做.就是说,少写两个函数. 而且输入格式方面也有点问题.当然,改起来不难. 如果你加分的话,我会帮你做完. 呵呵,其实做到这里,其它的也不难了,可以自己...

耿马傣族佤族自治县13351813273: 一个班有10名学生,需要存储每位学生的学号、姓名、以及某一门课程分数.编写程序实现: (1)增加 -
衅才儿童: 呵呵,熊猫不谢!#include<stdio.h> #include<string.h> struct Student { char name[20]; int ID,grade; };Student student[10]; int i=0,j,m,k,ID; char ch[10];void add() { printf("\n请添加学生信息\n");do { printf("\n请输入学生姓名\n"); gets(student[i...

耿马傣族佤族自治县13351813273: 如何编写一个排序程序 -
衅才儿童: struct stu { char name[20]; long number; float score[4]; }; struct stu student[4]; void input(struct stu arr[],int n) { int i,j; char temp[30]; for (i=0;iarr[j+1].score[3]) { temp=arr[j]; arr[j]=arr[j+1]; arr[j+1]=temp; } } void output(struct stu arr[],int n) { int i,j; for(i=0;i

耿马傣族佤族自治县13351813273: 输入10个学生的学号及单科成绩 -
衅才儿童: 程序采用结构体变量,代码如下: #include<stdio.h> #define k 10 struct student { char num[3]; int score; }; void tj(struct student[]); void main() { struct student st[k]; int i; printf("输入学生信息\n"); printf("\t学号\t单科成绩\n"); for (i=0;i<k;i++) {...

耿马傣族佤族自治县13351813273: 用C语言编程:从键盘输入10个学生的成绩和学号,将其排序输出,并输出中要有相应的学生学号 -
衅才儿童: # include<stdio.h>struct student {int id;int score; }stu[10];int main(void) {int i,m;struct student j; for( i=0; i<10; i++){printf("请输入学生的学号:");scanf("%d",&stu[i].id);printf("请输入学生的成绩:");scanf("%d",&stu[i]....

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网