資源描述:
《c語(yǔ)言課程設(shè)計(jì)源程序》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫(kù)。
1、C語(yǔ)言課程設(shè)計(jì)源程序第一天21輸入學(xué)生成績(jī)并顯示22顯示輸入數(shù)據(jù)33日歷源程序3第二天4字符排序4第三天5指法練習(xí)5第四天7漢諾塔(2)7第五天11排序(2)11第六天17模擬時(shí)鐘(3)17第七天261貪吃蛇游戲262學(xué)生管理系統(tǒng)31第一天1輸入學(xué)生成績(jī)并顯示#includestructstudent{charnumber[6];charname[6];intscore[3];}stu[2];voidoutput(structstudentstu[2]);voidmain(){inti,j;for(i=0;i<2;i+
2、+){printf("請(qǐng)輸入學(xué)生%d的成績(jī):",i+1);printf("學(xué)號(hào):");scanf("%s",stu[i].number);printf("姓名:");scanf("%s",stu[i].name);for(j=0;j<3;j++){printf("成績(jī)%d.",j+1);scanf("%d",&stu[i].score[j]);}printf("");}output(stu);}voidoutput(structstudentstu[2]){inti,j;printf("學(xué)號(hào)姓名成績(jī)1成績(jī)2成績(jī)3");for
3、(i=0;i<2;i++){printf("%-6s%-6s",stu[i].number,stu[i].name);for(j=0;j<3;j++)printf("%-8d",stu[i].score[j]);printf("");}}2顯示輸入數(shù)據(jù)#include#defineA"***"#defineB"**"#defineC"*"#defineD"*"main(){staticchar*head[5][10]={{A,D,A,A,B,A,A,A,A,A},{B,D,D,D,B,C,C,D,B,B},{B,D
4、,A,A,A,A,A,D,A,A},{B,D,C,D,D,D,B,D,B,D},{A,D,A,A,D,A,A,D,A,A}};intnum,i,j;charstr[5];scanf("%d",&num);itoa(num,str,10);for(i=0;i<5;i++){printf("%10s","");for(j=0;j<4;j++)printf("%s",head[i][str[j]-'0']);putchar('');}}3日歷源程序#includemain(){intweek,day,month,max
5、day;intyear;inti;printf("inputyearandmonth");scanf("%d%d",&year,&month);printf("inputweekdayanddaysum:");scanf("%d%d",&week,&maxday);printf("============%dyear%2dmonth================",year,month);printf("SUNMONTUEWEBTURFRISAT");for(i=0;i6、for(day=1;day<=maxday;day++){printf("%4d",day);week=(week+1)%7;if(week==0)printf("");}}第二天字符排序輸入一個(gè)字符串,可將字符串中的字符由小到大排列#include#includebubble(strings,count)char*strings;intcount;{registerintm,n;registerchars;for(m=1;m=m;--n){
7、if(strings[n-1]>strings[n]){s=strings[n-1];strings[n-1]=strings[n];strings[n]=s;}}}intmain(void){intcount;charstr[200];printf("請(qǐng)輸入字符串:");gets(str);count=strlen(str);bubble(str,count);printf("排序之后的字符串是:");printf("%s.",str);return0;}第三天指法練習(xí)/*模擬指法測(cè)試程序:完成輸入文字后,統(tǒng)計(jì)輸入的正確率
8、和輸入速度。*/#include#include#include#defineSIZE30win(){clrscr();gotoxy(20,2);prin