用结构体处理学生成绩
答://用结构体完成:编程求出3个学生中某个学生的平均成绩 include <iostream> include <string.h> using namespace std;struct student { char *name;double score[3];};struct student stu[3]={{"han",80,90,95},{"zhao",78,85,92},{"dan",75,60,59}}; //初始化 struct student *...
答:include <stdio.h> #define N 100 //数组总长,按需调整 /*定义学生结构体*/ struct Student { int ID; char Name[20]; float Mark1; float Mark2; // float Mark3; float Sum; }; /*声明学生数组及学生数量*/ struct Student students[N]; //...
答:void main(){ struct Student{ char id[10];char name[10];int score;} stu = {"001", "Sam", 80};printf("%s\t%s\t%d", stu.id, stu.name, stu.score);}
答:include<iostream>#include<string> using namespace std;//===<开始定义结构体>===struct combox{ int num;int mark;string name;combox *next;};//===<结束定义结构体>=== //===<开始定义Commonbox类>=== /
答:printf("成绩低于140的学生信息为:\n");for(i=0;i<5;i++)if(stus[i].score<140)printf("学生名:%s,成绩:%.1f\n",stus[i].name,stus[i].score);printf("\n");} void printStus(STU *stus){ int i;printf("结构数组中的信息为:\n");for(i=0;i<5;i++)printf("学生...
答:typedef struct /* 定义一个学生的结构体信息 */ { char student_name[20] ; /* 学生的姓名信息 */ int kemu1, kemu2, kemu3, kemu4, kemu5 ; /* 学生的五门课程成绩,这里以整数为例 */ } PERSON ;void main( ){ int total = 0 ; /* total:用于存放学生五门课程的总成绩 */ ...
答:{ char number[20];//number学号 char name[20];//name姓名 float score[3];//成绩 float aver;//平均分 };int main(){ struct student stu[3];int i,max;printf("请输入三位学生的学号、姓名、3门课的成绩(以空格分开输入):\n");for(i=0;i<3;i++){ printf("请输入第%d个学生...
答:typedef struct stu /*定义结构体数组用于缓存数据*/ { char num[6];char name[5];int score[3];int sum;float average;int order;struct stu *next;}STUDENT;/*函数原型*/ STUDENT *init(); /*初始化函数*/ int menu_select(); /*菜单函数*/ STUDENT *create(); /*创建链表*/ void ...
答:这就是最基本的结构体操作。include<stdio.h>typedef struct s{ char name[32]; int score;}student;int main(void){ student a,b,c; int max; scanf("%s%d", a.name, &a.score); scanf("%s%d", b.name, &b.score); scanf("%s%d", c.name, &c.score); ...
答:);/*输出*/puts ("学号\t姓名\t平时成绩\t期中成绩\t期末成绩\t学期成绩");for (i=0; i<stuNum; i++)printInfo (stu,i);getch (); /*屏幕暂留*/return 0;}运行结果以下图示改为2名学生,上方源代码为题主要求的5名学生
网友评论:
竺琪19533241527:
利用结构体类型编制程序,实现输入一个学生的数学期中和期末成绩,然后计算其平均成绩 -
1229璩兔
: #include <stdio.h> #define N 100 //数组总长,按需调整/*定义学生结构体*/ struct Student {int ID;char Name[20];float Mark1;float Mark2;// float Mark3;float Sum; }; /*声明学生数组及学生数量*/ struct Student students[N]; //预定义结构体数...
竺琪19533241527:
c++结构体1.定义一个学生成绩结构体类型,包含"学号"、"姓名"、"性别"、"年龄"、"班级"、"英语"、"数学"、"物理"、"总分"、"名... -
1229璩兔
:[答案] 你就定义结构体啊! struct student { int no; char name[10]; char sex[2]; int year; char class; float score[3];//三门课的成绩 float toal; //总分 int num; //名次 } stu[10];//例如10个学生
竺琪19533241527:
如何用c语言结构体指针输入一组学生成绩,查找最好成绩,并输出其学生信息 -
1229璩兔
: 有两种方法 1:用链表做 2:用文件做 用链表做主要在于结构体的构造 和相关数据的输入 查找 用文件做 主要在于对文件的读写 操作 你可以参考相关的c语言书籍 比如老谭的c语言
竺琪19533241527:
定义一个结构体类型的结构体数组stud,输入学生三门课成绩,然后按总分成绩排序后输出学生成绩. -
1229璩兔
: #include"stdio.h" #include"string.h" struct student { int num; char name[20]; float yingyu; float shuxue; float cc; float sum; }; struct student stud[100]; int main() { int i,n,k,j,z=1;float t;char m[20];printf("输入有N个学生数");scanf("%d",&...
竺琪19533241527:
用C++结构体编写学生成绩系统 -
1229璩兔
: #include<fstream.h>#include<iostream.h>#include<iomanip.h> class Stud { private: int no; char name[10]; int score1; int score2; int score3; int score4; public: void getdata() { cout<<"(学号 姓名 高等数学 英语 线性代数 程序设计成绩):"<<...
竺琪19533241527:
利用结构体编写一程序实现输入一个学生的数学期中和期末成绩输出其平均分 -
1229璩兔
: #include <stdio.h> struct student{ float grade1; float grade2; }; struct student wang; void main (void) { printf("please input the score\n"); scanf("%f",&wang.grade1); printf("please input the score\n"); scanf("%f",&wang.grade2); printf("%f",(wang.grade1 + wang.grade2) / 2); getch(); }
竺琪19533241527:
C语言 用结构体类型数组编程实现输入5个学生的学号姓名平时成绩期中成绩和期末成绩然后输出每位同学 -
1229璩兔
: #include <stdio.h>#include <string.h>//C语言 用结构体类型数组编程实现输入5个学生的学号姓名平时成绩期中成绩和期末成绩然后输出每位同学的学期成绩,(平时成绩占10%期中成绩占20%期末成绩占70%) struct Student { int id; char name[...
竺琪19533241527:
用结构体储存包括学号、姓名及语文、数学、c语言成绩的学生信息.
1229璩兔
:#include<stdio.h> struct stu {char xuehao[20];char name[20];int math;int c; }; int main() {stu student[3];int i=0;while (i<3){scanf("%s %s %d %d",student[i].xuehao,student[i].name,&student[i].math,&student[i].c);i++;}i=0;while(i<3){...
竺琪19533241527:
输入并输出5个学生的成绩的结构体的程序怎么编写? -
1229璩兔
: struct student { string name; int score; }; void main{ struct student stu[5]; printf("请输入学生的姓名,成绩"); for(i=0;i
竺琪19533241527:
利用结构体类型编制一程序,实现输入三个学生的学号,数学语文英语成绩,然后计算每位学生的总成绩以及平均 -
1229璩兔
: // struct.cpp : Defines the entry point for the console application. // #include "stdafx.h" /*利用结构体类型编制一程序,实现输入三个学生的学号, 数学语文英语成绩,然后计算每位学生的总成绩以及平均成绩 */ int main(int argc, char* argv[]) { ...