有一本講述C語言的書,自出版以來,歷經14載,它一直都被各個書評站點(或書評人)列入“重點推薦” 的清單中。尤為夸張的是,14年來,在它的18次印刷版本中,除去第二次印刷稍微修改過一些問題,以后的17 次印刷,我們居然發現它的內容沒有絲毫的變更?。?!對于技術書籍,我想其精確性與權威性也算是奇跡了吧。 這就是Andrew Koenig給我們帶來的C Traps and Pitfalls(《C陷阱與缺陷》)。 非常經典的書籍! 強烈推薦閱讀! 作者簡介: Andrew Koenig AT&T大規模程序研發部(前貝爾實驗室)成員。他從1986年開始從事C語言的研究,1977年加入貝爾實驗室。他編寫了一些早期的類庫,并在1988年組織召開了第一個完全意義上的C++會議。在ISO/ANSI C++委員會成立的1989年,他就加入了該委員會,并一直擔任項目編輯。他已經發表了C++方面的100多篇論文,在Addsion-Wesley出版了C Trap and Pitfalls,還應邀到世界各地演講。
標簽: C語言
上傳時間: 2014-11-29
上傳用戶:xinzhch
算法的許多例子都是最優化問題( optimization problem),每個最優化問題都包含一組限制條件( c o n s t r a i n t)和一個優化函數( optimization function),符合限制條件的問題求解方案稱為可行解( feasible solution),使優化函數取得最佳值的可行解稱為最優解(optimal solution)。
標簽: optimization problem 算法
上傳時間: 2014-08-25
上傳用戶:123456wh
車廂調度假設停在鐵路調度站入口處的車廂序列的編號依次為1,2,3……N。設計一個程序,求出所有由此輸出的長度為N的車廂序列。
上傳時間: 2014-11-27
上傳用戶:zl5712176
26.編寫一個具有如下樣式的類模板tmplt,用于實現所謂的反序輸出問題,其中使用了類型參數T(使所處理的元素類型可變化)以及普通參數n(元素個數也可變化): template <class T, int n> class tmplt { T arr[n] // n個T類型的數據存放于數組arr之中 public: void dataIn() //從鍵盤輸入n個T類型數據放入arr數組中 void reverseOut() //將arr數組中的數據按輸入的相反順序輸出 } 而后編制主函數,將類模板實例化為某個具體的類并說明類對象,之后通過對象調用其負責輸入數據的成員函數,再通過對象調用另一成員函數按反序輸出那些輸入數據。
上傳時間: 2014-01-07
上傳用戶:xiaoxiang
提 出了一種 網絡 化嵌 入 式 數 控 系統 , 系統 采 用 A RM 4 - D S P結 構 , 實現 了數 控 系統 的 小型 化 、 網絡 化 、 智能化 和 集成 化 。詳 細介 紹 了嵌入 式數 控 系統 內 CNC主控 單元 與 伺 服 驅動 及 I /0邏輯 控 制 等各 單 元 間的通信 、 車 間級 工 業 以太 網絡 的通信 和 i n t r a n e t / I n t e r n e t網絡 通信 , 并給 出 了關鍵 實現技 術。
標簽: 網絡
上傳時間: 2013-11-25
上傳用戶:as275944189
提 出了一種 網絡 化嵌 入 式 數 控 系統 , 系統 采 用 A RM 4 - D S P結 構 , 實現 了數 控 系統 的 小型 化 、 網絡 化 、 智能化 和 集成 化 。詳 細介 紹 了嵌入 式數 控 系統 內 CNC主控 單元 與 伺 服 驅動 及 I /0邏輯 控 制 等各 單 元 間的通信 、 車 間級 工 業 以太 網絡 的通信 和 i n t r a n e t / I n t e r n e t網絡 通信 , 并給 出 了關鍵 實現技 術。
標簽: 網絡
上傳時間: 2013-12-27
上傳用戶:huannan88
:假設停在鐵路調度站入口處的車廂序列的編號一次為1,2,3,…,n。設計一個程序,求出所有可能由此輸出的長度為n的車廂序列。
上傳時間: 2017-02-05
上傳用戶:蠢蠢66
一農場由圖所示的十一種小方塊組成,藍色線條為灌溉渠。若相鄰兩塊的灌溉渠相連則只需一口水井灌溉。給出若干由字母表示的最大不超過50×50具體由(m,n)表示,的農場圖,編程求出最小需要打的井數。每個測例的輸出占一行。當M=N=-1時結束程序。
標簽: 方塊
上傳時間: 2013-12-16
上傳用戶:風之驕子
#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