c语言课程设计题目C语言大一课程设计,我们期末考试的作业,大家给个代码啊,要求简单的动画或小游戏,谢谢

c语言课程设计题目  时间:2021-06-03  阅读:()

C语言..课程设计参考题目

#include<stdio.h> #include<conio.h> #include<math.h> #include<stdlib.h> #define UNKNOWN_CHAR 2 #define DIVISOR_IS_ZERO 3 #define FALSE 0 #define TRUE 1 typedef struct string {char str; struct string *next; }string; char *GetString(); double GetASResultOf(char * str, int *rank, int *errorNum); double GetUnitageOf(char * str, int *rank, int *errorNum); int main() { double value; int rank=0; int errorNum=TRUE; char * str; printf("Please input your arithmetic: "); str=GetString(); value = GetASResultOf(str, &rank, &errorNum); if (errorNum==TRUE) printf("The result is: %lf ",value, rank); else if (errorNum==UNKNOWN_CHAR) printf("char error! "); else if (errorNum==DIVISOR_IS_ZERO) printf("Divisor could not be 0 "); else printf("Other error "); getch(); return 0; } char *GetString() { char *CharToString(string * sHead, int arraySize); int arraySize=0; string *s; string *sHead; s = (string *)malloc(sizeof(string)); sHead = s; s->str = getchar(); arraySize++; while((s->str)!=' ') { arraySize++; s->next=(string *)malloc(sizeof(string)); s=s->next; s->str=getchar(); } return CharToString(sHead, arraySize); } char *CharToString(string * sHead, int arraySize) { char *strArray; string *s=sHead; int i=0; strArray = (char*)malloc(arraySize*sizeof(char)); while(i<arraySize) { if (s->str=='=' || s->str==' ') break; if (s->str!=32) strArray[i++]=s->str; s=s->next; } strArray[i]=''; return strArray; }

C语言课程设计

#include"stdio.h"#include "stdlib.h" #define SIZE 10 struct chenji {puter; float program; float math; float english; float PE; }; struct student {char num[12]; char name[20]; char sex[2]; int age; struct chenji score; }std1[SIZE],std2[SIZE]; inputdata() {int i; printf("Number name sex(M/F) puter Program Math English PE "); for(i=0;i<SIZE;i++) scanf("%s%s%s%d%f%f%f%f%f ",std1.num,std1.name,std1.sex,std1.age,puter,std1.score.program,std1.score.math,std1.score.english,std1.score.PE); } datawrite() {FILE *fp; /*学生成绩管理系统,c语言课程设计*/int i; fp=fopen("STD.DAT","wb");if(fp==NULL) {printf("can not open the file "); exit(0); } for(i=0;i<SIZE;i++) {fwrite(std1,sizeof(struct student),1,fp); } fclose(fp); }

C语言大一课程设计,我们期末考试的作业,大家给个代码啊,要求简单的动画或小游戏,谢谢

我给你个游戏,是贪吃蛇的 #define N 200 #include <graphics.h> #include <stdlib.h> #include <dos.h> #define LEFT 0x4b00 #define RIGHT 0x4d00 #define DOWN 0x5000 #define UP 0x4800 #define ESC 0x011b int i,key; int score=0;/*得分*/ int gamespeed=50000;/*游戏速度自己调整*/ struct Food { int x;/*食物的横坐标*/ int y;/*食物的纵坐标*/ int yes;/*判断是否要出现食物的变量*/ }food;/*食物的结构体*/ struct Snake { int x[N]; int y[N]; int node;/*蛇的节数*/ int direction;/*蛇移动方向*/ int life;/* 蛇的生命,0活着,1死亡*/ }snake; void Init(void);/*图形驱动*/ void Close(void);/*图形结束*/ void DrawK(void);/*开始画面*/ void GameOver(void);/*结束游戏*/ void GamePlay(void);/*玩游戏具体过程*/ void PrScore(void);/*输出成绩*/ /*主函数*/ void main(void) { Init();/*图形驱动*/ DrawK();/*开始画面*/ GamePlay();/*玩游戏具体过程*/ Close();/*图形结束*/ } /*图形驱动*/ void Init(void) { int gd=DETECT,gm; initgraph(&gd,&gm,"c:\tc"); cleardevice(); } /*开始画面,左上角坐标为(50,40),右下角坐标为(610,460)的围墙*/ void DrawK(void) { /*setbkcolor(LIGHTGREEN);*/ setcolor(11); setlinestyle(SOLID_LINE,0,THICK_WIDTH);/*设置线型*/ for(i=50;i<=600;i+=10)/*画围墙*/ { rectangle(i,40,i+10,49); /*上边*/ rectangle(i,451,i+10,460);/*下边*/ } for(i=40;i<=450;i+=10) { rectangle(50,i,59,i+10); /*左边*/ rectangle(601,i,610,i+10);/*右边*/ } }

  • c语言课程设计题目C语言大一课程设计,我们期末考试的作业,大家给个代码啊,要求简单的动画或小游戏,谢谢相关文档

90IDC-香港云主机,美国服务器,日本KVM高性能云主机,创建高性能CLOUD只需60秒即可开通使用!

官方网站:点击访问90IDC官方网站优惠码:云八五折优惠劵:90IDCHK85,仅适用于香港CLOUD主机含特惠型。活动方案:年付特惠服务器:CPU均为Intel Xeon两颗,纯CN2永不混线,让您的网站更快一步。香港大浦CN2測速網址: http://194.105.63.191美国三网CN2測速網址: http://154.7.13.95香港购买地址:https://www.90idc.ne...

Megalayer促销:美国圣何塞CN2线路VPS月付48元起/香港VPS月付59元起/香港E3独服月付499元起

Megalayer是新晋崛起的国外服务器商,成立于2019年,一直都处于稳定发展的状态,机房目前有美国机房,香港机房,菲律宾机房。其中圣何塞包括CN2或者国际线路,Megalayer商家提供了一些VPS特价套餐,譬如15M带宽CN2线路主机最低每月48元起,基于KVM架构,支持windows或者Linux操作系统。。Megalayer技术团队行业经验丰富,分别来自于蓝汛、IBM等知名企业。Mega...

VPSDime7美元/月,美国达拉斯Windows VPS,2核4G/50GB SSD/2TB流量/Hyper-V虚拟化

VPSDime是2013年成立的国外VPS主机商,以大内存闻名业界,主营基于OpenVZ和KVM虚拟化的Linux套餐,大内存、10Gbps大带宽、大硬盘,有美国西雅图、达拉斯、新泽西、英国、荷兰机房可选。在上个月搞了一款达拉斯Linux系统VPS促销,详情查看:VPSDime夏季促销:美国达拉斯VPS/2G内存/2核/20gSSD/1T流量/$20/年,此次推出一款Windows VPS,依然是...

c语言课程设计题目为你推荐
chrome系统Chrome系统怎么进biosqq博客怎么开QQ博客啊华为总裁女儿为啥姓孟孟姜女为什么不姓孟?什么是生态系统生态系统的我主要特征是什么?中信银行理财宝中信银行理财宝金卡怎样激活网络电话免费版有没有免费的网络电话?纯免费的红牛下架红牛下架事件怎么回事?美宜佳最近怎么买不到红牛了?软件开发技术文档软件开发项目中,过程管理文档都包括什么?病毒分析网站25个最恶意的病毒网站私服发布站程序私服发布站
免费域名空间申请 kvmla patcha win8升级win10正式版 免费网络电视 eq2 华为4核 秒杀预告 ntfs格式分区 常州联通宽带 cloudlink 空间首页登陆 免费邮件服务器 云营销系统 万网空间 摩尔庄园注册 阿里云邮箱登陆 netvigator windowsserver2012r2 winserver2008r2 更多