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语言大一课程设计,我们期末考试的作业,大家给个代码啊,要求简单的动画或小游戏,谢谢相关文档

亚洲云-浙江高防BGP,至强铂金8270,提供自助防火墙管理,超大内存满足你各种需求

官方网站:点击访问亚洲云官网618活动方案:618特价活动(6.18-6.30)全站首月活动月底结束!地区:浙江高防BGPCPU:至强铂金8270主频7 默频3.61 睿频4.0核心:8核(最高支持64核)内存:8G(最高支持128G)DDR4 3200硬盘:40G系统盘+80G数据盘带宽:上行:20Mbps/下行:1000Mbps防御:100G(可加至300G)防火墙:提供自助 天机盾+金盾 管...

轻云互联(19元)香港高防云服务器 ,美国云服务器

轻云互联成立于2018年的国人商家,广州轻云互联网络科技有限公司旗下品牌,主要从事VPS、虚拟主机等云计算产品业务,适合建站、新手上车的值得选择,香港三网直连(电信CN2GIA联通移动CN2直连);美国圣何塞(回程三网CN2GIA)线路,所有产品均采用KVM虚拟技术架构,高效售后保障,稳定多年,高性能可用,网络优质,为您的业务保驾护航。活动规则:用户购买任意全区域云服务器月付以上享受免费更换IP服...

VPS云服务器GT线路,KVM虚vps消息CloudCone美国洛杉矶便宜年付VPS云服务器补货14美元/年

近日CloudCone发布了最新的补货消息,针对此前新年闪购年付便宜VPS云服务器计划方案进行了少量补货,KVM虚拟架构,美国洛杉矶CN2 GT线路,1Gbps带宽,最低3TB流量,仅需14美元/年,有需要国外便宜美国洛杉矶VPS云服务器的朋友可以尝试一下。CloudCone怎么样?CloudCone服务器好不好?CloudCone值不值得购买?CloudCone是一家成立于2017年的美国服务器...

c语言课程设计题目为你推荐
chinapay什么是银联Chinapay CD卡?决策树分析什么是决策树法匹配函数Excel中vlookup函数数据匹配怎么用视频技术视频监控技术的定义及特点华为总裁女儿为啥姓孟孟晚舟是谁搜索引擎的概念什么叫搜索引擎?搜索引擎的类型有哪些?自定义表情手机qq添加的自定义表情怎么分组awvawv格式是否等于MP4格式部署工具win10 评估和部署工具包有什么用网络电话免费版有没有免费的网络电话?纯免费的
godaddy域名注册 256m内存 美国php空间 国内加速器 最好看的qq空间 个人域名 中国电信测网速 如何安装服务器系统 域名与空间 双线空间 工信部icp备案查询 空间申请 免费稳定空间 锐速 server2008 cc加速器 时间同步服务器 pptpvpn 连连支付 超低价 更多