最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

C語(yǔ)言學(xué)生成績(jī)管理系統(tǒng)源碼

 更新時(shí)間:2022年03月02日 09:27:30   作者:reg183  
這篇文章主要為大家詳細(xì)介紹了C語(yǔ)言學(xué)生成績(jī)管理系統(tǒng)源碼,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了C語(yǔ)言學(xué)生成績(jī)管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下

效果如下:

代碼如下:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct student{
? ? ? ? int num;
? ? ? ? char name[20];
? ? ? ? float score1;
? ? ? ? float score2;
? ? ? ? float score3;
? ? ? ? double total;
}stu[4];


void a();
void b();
void c();
void d();
void e();
int main(void)
{
? ? //printf("Hello World!\n");


? ? ? ?int n;
? ? ? ?while(n!=6){

? ? ? ? ? ?printf("\t student score manage system\n");
? ? ? ? ? ?printf("1-input all student's score!\n");
? ? ? ? ? ?printf("2-show all student's score!\n");
? ? ? ? ? ?printf("3-output student's average score!\n");
? ? ? ? ? ?printf("4-output student's score and rank!\n");
? ? ? ? ? ?printf("5-result output txt file!\n");
? ? ? ? ? ?printf("6-exit!\n");
? ? ? ? ? ?scanf("%d",&n);
? ? ? ? ? ?switch(n){
? ? ? ? ? ? ? ?case 1:a();break;
? ? ? ? ? ? ? ?case 2:b();break;
? ? ? ? ? ? ? ?case 3:c();break;
? ? ? ? ? ? ? ?case 4:d();break;
? ? ? ? ? ? ? ?case 5:e();break;
? ? ? ? ? ? ? ?case 6:printf("******ByeBye******");break;
? ? ? ? ? ?}
? ? ? ?}

? ? return 0;
}

//輸入成績(jī)
void a(){
? ? int i;
? ? for(i=0;i<4;i++){
? ? ? ? printf("input num name score1 score2 score3: ");
? ? ? ? scanf("%d%s%f%f%f",&stu[i].num,stu[i].name,&stu[i].score1,&stu[i].score2,&stu[i].score3);
? ? }

? ? for(i=0;i<4;i++){
? ? ? ? stu[i].total=stu[i].score1+stu[i].score2+stu[i].score3;
? ? }
}
//輸出成績(jī)
void b(){
? ? int i;
? ? printf("num \t name \t score1 \t score2 \t score3 \t total \n");
? ? for(i=0;i<4;i++){
? ? ? ? printf("%d \t %s \t %f \t %f \t %f \t %f \n",stu[i].num,stu[i].name,stu[i].score1,stu[i].score2,stu[i].score3,stu[i].total);
? ? }
}

//求平均成績(jī)
void c(){

? ? double total=0;
? ? double avg;
? ? int i;
? ? for(i=0;i<4;i++){
? ? ? ? total+=stu[i].total;
? ? }
? ? avg=total/4.0;
? ? printf("avg is :%f \n",avg);
}

//按照總成績(jī)排序
void d(){
? ? struct student temp;
? ? int i,j;
? ? for(i=0;i<4;i++){

? ? ? ? for(j=i+1;j<4;j++){
? ? ? ? ? ? temp=stu[i];
? ? ? ? ? ? stu[i]=stu[j];
? ? ? ? ? ? stu[j]=temp;
? ? ? ? }
? ? }

? ? printf("num \t name \t score1 \t score2 \t score3 \t total \n");
? ? for(i=0;i<4;i++){
? ? ? ? printf("%d \t %s \t %f \t %f \t %f \t %f \n",stu[i].num,stu[i].name,stu[i].score1,stu[i].score2,stu[i].score3,stu[i].total);
? ? }
}

// 保存數(shù)據(jù)到文件
void e(){

? ? int i;
? ? FILE *fp;
? ? fp=fopen("E:/result.txt","w");

? ? fprintf(fp,"num \t name \t score1 \t score2 \t score3 \t total \n");

? ? for(i=0;i<4;i++){
? ? ? ? fprintf(fp,"%d \t %s \t %f \t %f \t %f \t %f \n",stu[i].num,stu[i].name,stu[i].score1,stu[i].score2,stu[i].score3,stu[i].total);

? ? }

? ? printf(" save success! \n ");
}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • C++實(shí)現(xiàn)五子棋游戲

    C++實(shí)現(xiàn)五子棋游戲

    這篇文章主要為大家詳細(xì)介紹了C++實(shí)現(xiàn)五子棋游戲,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-01-01
  • C++對(duì)象模型和this指針詳解

    C++對(duì)象模型和this指針詳解

    這篇文章主要介紹了詳解C++對(duì)象模型和this指針,是C++入門學(xué)習(xí)中的基礎(chǔ)知識(shí),需要的朋友可以參考下,希望能夠給你帶來(lái)幫助
    2021-10-10
  • C語(yǔ)言鏈接屬性的實(shí)踐應(yīng)用

    C語(yǔ)言鏈接屬性的實(shí)踐應(yīng)用

    C語(yǔ)言中鏈接屬性決定如何處理在不同文件中出現(xiàn)的標(biāo)示符,下面這篇文章主要給大家介紹了關(guān)于C語(yǔ)言鏈接屬性的實(shí)踐應(yīng)用,文中通過(guò)示例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-03-03
  • C++ 基礎(chǔ)編程之十進(jìn)制轉(zhuǎn)換為任意進(jìn)制及操作符重載

    C++ 基礎(chǔ)編程之十進(jìn)制轉(zhuǎn)換為任意進(jìn)制及操作符重載

    這篇文章主要介紹了C++ 基礎(chǔ)編程之十進(jìn)制轉(zhuǎn)換為任意進(jìn)制及操作符重載的相關(guān)資料,需要的朋友可以參考下
    2017-02-02
  • 哈夫曼的c語(yǔ)言實(shí)現(xiàn)代碼

    哈夫曼的c語(yǔ)言實(shí)現(xiàn)代碼

    著先通過(guò) HuffmanTree() 函數(shù)構(gòu)造哈夫曼樹,然后在主函數(shù) main()中自底向上開始(也就是從數(shù)組序號(hào)為零的結(jié)點(diǎn)開始)向上層層判斷,若在父結(jié)點(diǎn)左側(cè),則置碼為 0,若在右側(cè),則置碼為 1。最后輸出生成的編碼
    2013-07-07
  • C++11 并發(fā)指南之std::thread 詳解

    C++11 并發(fā)指南之std::thread 詳解

    這篇文章主要介紹了C++11 并發(fā)指南之std::thread 詳解,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-02-02
  • OpenCV實(shí)現(xiàn)特征檢測(cè)和特征匹配方法匯總

    OpenCV實(shí)現(xiàn)特征檢測(cè)和特征匹配方法匯總

    一幅圖像中總存在著其獨(dú)特的像素點(diǎn),這些點(diǎn)我們可以認(rèn)為就是這幅圖像的特征,成為特征點(diǎn),本文主要介紹了OpenCV實(shí)現(xiàn)特征檢測(cè)和特征匹配方法,感興趣的可以了解一下
    2021-08-08
  • 詳解c++優(yōu)先隊(duì)列priority_queue的用法

    詳解c++優(yōu)先隊(duì)列priority_queue的用法

    本文詳細(xì)講解了c++優(yōu)先隊(duì)列priority_queue的用法,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-12-12
  • C++編程模板匹配超詳細(xì)的識(shí)別手寫數(shù)字實(shí)現(xiàn)示例

    C++編程模板匹配超詳細(xì)的識(shí)別手寫數(shù)字實(shí)現(xiàn)示例

    大家好!本篇文章是關(guān)于手寫數(shù)字識(shí)別的,接下來(lái)我將在這里記錄我的手寫數(shù)字識(shí)別的從零到有,我在這里把我自己的寫代碼過(guò)程發(fā)出來(lái),希望能幫到和我一樣努力求知的人
    2021-10-10
  • C++深入探究二階構(gòu)造模式的原理與使用

    C++深入探究二階構(gòu)造模式的原理與使用

    C++中經(jīng)常會(huì)因?yàn)檎{(diào)用系統(tǒng)資源失敗導(dǎo)致出現(xiàn)BUG,所以在類調(diào)用構(gòu)造函數(shù)需要分配系統(tǒng)資源時(shí)會(huì)出現(xiàn)BUG,從而導(dǎo)致類對(duì)象雖然被創(chuàng)建,但是只是個(gè)半成品,為了避免這種情況需要使用二階構(gòu)造模式
    2022-04-04

最新評(píng)論

延长县| 会昌县| 丹凤县| 长沙县| 遂宁市| 南木林县| 专栏| 馆陶县| 葵青区| 凉山| 台北县| 安岳县| 鲁甸县| 德昌县| 恩平市| 监利县| 达拉特旗| 历史| 萨嘎县| 梁山县| 博湖县| 南部县| 凌海市| 泸定县| 突泉县| 增城市| 综艺| 石狮市| 望都县| 安丘市| 三都| 漳平市| 晋宁县| 临沂市| 崇信县| 黑山县| 莱阳市| 平武县| 渭南市| 呼玛县| 平江县|