#include <malloc.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define NULL 0 #define MaxSize 30 typedef struct athletestruct /*運動員*/ { char name[20]; int score; /*分數*/ int range; /**/ int item; /*項目*/ }ATH; typedef struct schoolstruct /*學校*/ { int count; /*編號*/ int serial; /**/ int menscore; /*男選手分數*/ int womenscore; /*女選手分數*/ int totalscore; /*總分*/ ATH athlete[MaxSize]; /**/ struct schoolstruct *next; }SCH; int nsc,msp,wsp; int ntsp; int i,j; int overgame; int serial,range; int n; SCH *head,*pfirst,*psecond; int *phead=NULL,*pafirst=NULL,*pasecond=NULL; void create(); void input () { char answer; head = (SCH *)malloc(sizeof(SCH)); /**/ head->next = NULL; pfirst = head; answer = 'y'; while ( answer == 'y' ) { Is_Game_DoMain: printf("\nGET Top 5 when odd\nGET Top 3 when even"); printf("\n輸入運動項目序號 (x<=%d):",ntsp); scanf("%d",pafirst); overgame = *pafirst; if ( pafirst != phead ) { for ( pasecond = phead ; pasecond < pafirst ; pasecond ++ ) { if ( overgame == *pasecond ) { printf("\n這個項目已經存在請選擇其他的數字\n"); goto Is_Game_DoMain; } } } pafirst = pafirst + 1; if ( overgame > ntsp ) { printf("\n項目不存在"); printf("\n請重新輸入"); goto Is_Game_DoMain; } switch ( overgame%2 ) { case 0: n = 3;break; case 1: n = 5;break; } for ( i = 1 ; i <= n ; i++ ) { Is_Serial_DoMain: printf("\n輸入序號 of the NO.%d (0<x<=%d): ",i,nsc); scanf("%d",&serial); if ( serial > nsc ) { printf("\n超過學校數目,請重新輸入"); goto Is_Serial_DoMain; } if ( head->next == NULL ) { create(); } psecond = head->next ; while ( psecond != NULL ) { if ( psecond->serial == serial ) { pfirst = psecond; pfirst->count = pfirst->count + 1; goto Store_Data; } else { psecond = psecond->next; } } create(); Store_Data: pfirst->athlete[pfirst->count].item = overgame; pfirst->athlete[pfirst->count].range = i; pfirst->serial = serial; printf("Input name:) : "); scanf("%s",pfirst->athlete[pfirst->count].name); } printf("\n繼續輸入運動項目(y&n)?"); answer = getchar(); printf("\n"); } } void calculate() /**/ { pfirst = head->next; while ( pfirst->next != NULL ) { for (i=1;i<=pfirst->count;i++) { if ( pfirst->athlete[i].item % 2 == 0 ) { switch (pfirst->athlete[i].range) { case 1:pfirst->athlete[i].score = 5;break; case 2:pfirst->athlete[i].score = 3;break; case 3:pfirst->athlete[i].score = 2;break; } } else { switch (pfirst->athlete[i].range) { case 1:pfirst->athlete[i].score = 7;break; case 2:pfirst->athlete[i].score = 5;break; case 3:pfirst->athlete[i].score = 3;break; case 4:pfirst->athlete[i].score = 2;break; case 5:pfirst->athlete[i].score = 1;break; } } if ( pfirst->athlete[i].item <=msp ) { pfirst->menscore = pfirst->menscore + pfirst->athlete[i].score; } else { pfirst->womenscore = pfirst->womenscore + pfirst->athlete[i].score; } } pfirst->totalscore = pfirst->menscore + pfirst->womenscore; pfirst = pfirst->next; } } void output() { pfirst = head->next; psecond = head->next; while ( pfirst->next != NULL ) { // clrscr(); printf("\n第%d號學校的結果成績:",pfirst->serial); printf("\n\n項目的數目\t學校的名字\t分數"); for (i=1;i<=ntsp;i++) { for (j=1;j<=pfirst->count;j++) { if ( pfirst->athlete[j].item == i ) { printf("\n %d\t\t\t\t\t\t%s\n %d",i,pfirst->athlete[j].name,pfirst->athlete[j].score);break; } } } printf("\n\n\n\t\t\t\t\t\t按任意建 進入下一頁"); getchar(); pfirst = pfirst->next; } // clrscr(); printf("\n運動會結果:\n\n學校編號\t男運動員成績\t女運動員成績\t總分"); pfirst = head->next; while ( pfirst->next != NULL ) { printf("\n %d\t\t %d\t\t %d\t\t %d",pfirst->serial,pfirst->menscore,pfirst->womenscore,pfirst->totalscore); pfirst = pfirst->next; } printf("\n\n\n\t\t\t\t\t\t\t按任意建結束"); getchar(); } void create() { pfirst = (struct schoolstruct *)malloc(sizeof(struct schoolstruct)); pfirst->next = head->next ; head->next = pfirst ; pfirst->count = 1; pfirst->menscore = 0; pfirst->womenscore = 0; pfirst->totalscore = 0; } void Save() {FILE *fp; if((fp = fopen("school.dat","wb"))==NULL) {printf("can't open school.dat\n"); fclose(fp); return; } fwrite(pfirst,sizeof(SCH),10,fp); fclose(fp); printf("文件已經成功保存\n"); } void main() { system("cls"); printf("\n\t\t\t 運動會分數統計\n"); printf("輸入學校數目 (x>= 5):"); scanf("%d",&nsc); printf("輸入男選手的項目(x<=20):"); scanf("%d",&msp); printf("輸入女選手項目(<=20):"); scanf("%d",&wsp); ntsp = msp + wsp; phead = (int *)calloc(ntsp,sizeof(int)); pafirst = phead; pasecond = phead; input(); calculate(); output(); Save(); }
標簽: 源代碼
上傳時間: 2016-12-28
上傳用戶:150501
#include<stdio.h> #include<windows.h> int xuanxiang; int studentcount; int banjihao[100]; int xueqihao[100][10]; char xm[100][100]; int xuehao[100][10]; int score[100][3]; int yuwen; int shuxue[000]; int yingyu[100]; int c[100]; int p; char x[1000][100]="",y[100][100]="";/*x學院 y專業 z班級*/ int z[100]; main() { void input(); void inputsc(); void alter(); void scbybannji(); printf("--------學生成績管理-----\n"); printf("請按相應數字鍵來實現相應功能\n"); printf("1.錄入學生信息 2.錄入學生成績 3.修改學生成績\n"); printf("4.查詢學生成績 5.不及格科目及名單 6.按班級輸出學生成績單\n"); printf("請輸入你要實現的功能所對應的數字:"); scanf("%d",&xuanxiang); system("cls"); getchar(); switch (xuanxiang) { case 1:input(); case 2:inputsc(); case 3:alter(); /*case 4:select score(); case 5:bujigekemujimingdan();*/ case 6:scbybanji; } } void input() { int i; printf("請輸入你的學院名稱:"); gets(x); printf("請輸入你的專業名稱:"); gets(y); printf("請輸入你的班級號:"); scanf("%d",&z); printf("請輸入你們一個班有幾個人:"); scanf("%d",&p); system("cls"); for(i=0;i<p;i++) { printf("請輸入第%d個學生的學號:",i+1); scanf("%d",xuehao[i]); getchar(); printf("請輸入第%d個學生的姓名:",i+1); gets(xm[i]); system("cls"); } printf("您已經錄入完畢您的班級所有學生的信息!\n"); printf("您的班級為%s%s%s\n",x,y,z); /*alter(p);*/ } void inputsc() { int i; for(i=0;i<p;i++) { printf("\n"); printf("--------------------------------------------------------------------------------\n\n"); printf("\t\t\t\t錄入學生的成績\n\n\n"); printf("--------------------------------------------------------------------------------\n\n"); printf("\t\t\t\t%s\n",xm[i]); printf("\n"); printf("\t\t\t\t數學:"); scanf("%d",&shuxue[i]); printf("\n"); getchar(); printf("\t\t\t\t英語:"); scanf("%d",&yingyu[i]); printf("\n"); getchar(); printf("\t\t\t\tc語言:"); scanf("%d",&c[i]); system("cls"); } } void alter() { int i;/*循環變量*/ int m[10000];/*要查詢的學號*/ int b;/*修改后的成績*/ char kemu[20]=""; printf("請輸入你要修改的學生的學號"); scanf("%d",&m); for (i=0;i<p;i++) { if (m==xuehao[i]) { printf("%s的數學成績為%d,英語成績為%d,c語言成績為%d,xm[i],shuxue[i],yingyu[i],c[i]"); printf("請輸入你想修改的科目");} } gets(kemu); getchar(); if (kemu=="數學"); { scanf("%d",&b); shuxue[i]=b;} if (kemu=="英語"); { scanf("%d",&b); yingyu[i]=b;} if (kemu=="c語言"); { scanf("%d",&b); c[i]=b; } printf("%s的數學成績為%d,英語成績為%d,c語言成績為%d,xm[i],shuxue[i],yingyu[i],c[i]"); } void scbybannji() { int i; char zyname[20]; int bjnumber; printf("請輸入你的專業名稱"); scanf("%s",&zyname); printf("請輸入你的班級號"); scanf("%d",&bjnumber); for (i=0;i<p;i++) { if (zyname==y[i]); if (bjnumber==z[i]); printf("專業名稱%s班級號%d數學成績%d英語成績%dc語言成績%d,y[i],z[i],shuxue[i],yingyu[i],c[i]"); } }
標簽: c語言
上傳時間: 2018-06-08
上傳用戶:2369043090
1.2 源代碼表示不考慮主題,列舉 15 000行源代碼本身就是一件難事。下面是所有源代碼都使用的文本格式:1.2.1 將擁塞窗口設置為13 8 7 - 3 8 8 這是文件t c p _ s u b r . c中的函數t c p _ q u e n c h。這些源文件名引用4 . 4 B S D - L i t e發布的文件。4 . 4 B S D在1 . 1 3節中討論。每個非空白行都有編號。正文所描述的代碼的起始和結束位置的行號記于行開始處,如本段所示。有時在段前有一個簡短的描述性題頭,對所描述的代碼提供一個概述。這些源代碼同4 . 4 B S D - L i t e發行版一樣,偶爾也包含一些錯誤,在遇到時我們會提出來并加以討論,偶爾還包括一些原作者的編者評論。這些代碼已通過了 G N U縮進程序的運行,使它們從版面上看起來具有一致性。制表符的位置被設置成 4個欄的界線使得這些行在一個頁面中顯示得很合適。在定義常量時,有些 # i f d e f語句和它們的對應語句 # e n d i f被刪去(如:G A T E W A Y和M R O U T I N G,因為我們假設系統被作為一個路由器或多播路由器 )。所有r e g i s t e r說明符被刪去。有些地方加了一些注釋,并且一些注釋中的印刷錯誤被修改了,但代碼的其他部分被保留下來。這些函數大小不一,從幾行 (如前面的t c p _ q u e n c h)到最大11 0 0行(t c p _ i n p u t)。超過大約4 0行的函數一般被分成段,一段一段地顯示。雖然盡量使代碼和相應的描述文字放在同一頁或對開的兩頁上,但為了節約版面,不可能完全做到。本書中有很多對其他函數的交叉引用。為了避免給每個引用都添加一個圖號和頁碼,書封底內頁中有一個本書中描述的所有函數和宏的字母交叉引用表和描述的起始頁碼。因為本書的源代碼來自公開的 4 . 4 B S D _ L i t e版,因此很容易獲得它的一個拷貝:附錄 B詳細說明了各種方法。當你閱讀文章時,有時它會幫助你搜索一個在線拷貝 [例如U n i x程序grep ( 1 )]。描述一個源代碼模塊的各章通常以所討論的源文件的列表開始,接著是全局變量、代碼維護的相關統計以及一個實際系統的一些例子統計,最后是與所描述協議相關的 S N M P變量。全局變量的定義通常跨越各種源文件和頭文件,因此我們將它們集中到的一個表中以便于參考。這樣顯示所有的統計,簡化了后面當統計更新時對代碼的討論。卷 1的第2 5章提供了S N M P的所有細節。我們在本文中關心的是由內核中的 T C P / I P例程維護的、支持在系統上運行的S N M P代理的信息。TCP IP詳解 卷1協議 :http://dl.21ic.com/download/tcpip-288223.html TCP IP詳解 卷2實現 :http://dl.21ic.com/download/tcpip-288224.html TCPIP詳解卷三:TCP事務協議,HTTP,NNTP和UNIX域協議 :http://dl.21ic.com/download/tcpip-288225.html
上傳時間: 2022-07-27
上傳用戶:
dsp hư ớ ng dẫ n giao tiế p LCD code viế t bằ ng C
上傳時間: 2017-06-17
上傳用戶:xuanjie
dsp từ cơ bả n đ ế n nâ ng cao 1
上傳時間: 2014-12-05
上傳用戶:watch100
LinQ SQL TẤ N CÔ NG KIỂ U SQL INJECTION - TÁ C HẠ I VÀ PHÒ NG TRÁ NH
上傳時間: 2013-12-15
上傳用戶:eclipse
Fortran - Tóm tắ t nộ i dung mô n họ c Các khái niệ m và yế u tố trong ngô n ngữ lậ p trình FORTRAN. Các câ u lệ nh củ a ngô n ngữ FORTRAN. Cơ bả n về chư ơ ng chư ơ ng dị ch và mô i trư ờ ng lậ p trình DIGITAL Visual Fortran. Viế t và chạ y các chư ơ ng trình cho các bài toán đ ơ n giả n bằ ng ngô n ngữ FORTRAN.
上傳時間: 2013-12-25
上傳用戶:songrui
c++ Ngô n ngữ C cho vi đ iề u khiể n Các tài liệ u tham khả o, ebook. Programming Microcontrollers in C (Ted Van Sickle) C Programming for Microcontrollers (Joe Pardue SmileyMicros.com ) Programming 16-Bit PIC Microcontrollers in C (Jucio di jasio ) C Programming for AVR Programming embedded system I,II (Michael J . Pont ) ( các tài liệ u này đ ã down load về )
上傳時間: 2017-07-29
上傳用戶:壞壞的華仔
metricmatlab ch ¬ ng 4 Ma trË n - c¸ c phÐ p to¸ n vÒ ma trË n. 4.1 Kh¸ i niÖ m: - Trong MATLAB d÷ liÖ u ® Ó ® a vµ o xö lý d íi d¹ ng ma trË n. - Ma trË n A cã n hµ ng, m cét ® î c gä i lµ ma trË n cì n m. § î c ký hiÖ u An m - PhÇ n tö aij cñ a ma trË n An m lµ phÇ n tö n» m ë hµ ng thø i, cét j . - Ma trË n ® ¬ n ( sè ® ¬ n lÎ ) lµ ma trË n 1 hµ ng 1 cét. - Ma trË n hµ ng ( 1 m ) sè liÖ u ® î c bè trÝ trª n mét hµ ng. a11 a12 a13 ... a1m - Ma trË n cét ( n 1) sè liÖ u ® î c bè trÝ trª n 1 cét.
標簽: metricmatlab 203 184 tr
上傳時間: 2017-07-29
上傳用戶:來茴
slickeditv10.0linuxcrackz.w.t.zip SlickEdit v10.0 for linux 注冊機 在國內網站上找了N天都沒找到,在國外一家網站找到。雖然不是源代碼,但是SlickEdit是Linux下最好用的30多種編程IDE。這個是注冊機安裝文件在百度裡找吧
標簽: 10.0 linuxcrackz slickeditv SlickEdit
上傳時間: 2013-12-10
上傳用戶:大融融rr