QQ登录

只需要一步,快速开始

 注册地址  找回密码

tag 标签: C语言

相关帖子

版块 作者 回复/查看 最后发表
decomp在c语言里是什么意思?用法是什么?急用!请帮帮忙! C/C++ 花如梦 2011-11-14 1 3450 花如梦 2011-11-14 11:17
C语言 attachment C/C++ 截拳道 2011-12-20 0 2257 截拳道 2011-12-20 11:04
C语言编译软件? C/C++ 无声的回忆24 2012-3-23 8 4848 心之所感 2017-6-28 12:58
C语言深度解剖.pdf attachment C/C++ txwgzyzz 2012-4-3 1 2745 2577648308 2012-4-8 21:26
禁忌搜索求解硬时间窗车辆路径(VRPTW) C语言 attach_img 算法类综合讨论版 在也 2012-4-15 0 3541 在也 2012-4-15 13:55
怎么样用c语言运算大规模的矩阵~ 数据结构算法 灰溜溜的流光 2012-5-6 0 4566 灰溜溜的流光 2012-5-6 14:32
怎么样用c语言来处理大规模数据呢~ 东北三省数学建模联赛 灰溜溜的流光 2012-5-6 2 2503 灰溜溜的流光 2012-5-6 18:37
数据结构教程》(C语言版) 清华大学 严蔚敏 attachment 数据结构算法 wycdbg 2012-5-15 3 7284 bjdigitial 2021-8-14 09:02
《C语言实例解析精粹》第一版+第二版+两版配书光盘 attachment C/C++ hopeoflight 2012-5-23 20 12122 lbh 2022-3-6 01:18
新概念51单片机C语言教程 入门、提高、开发、拓展全攻 attach_img C/C++ hopeoflight 2012-5-23 14 6245 智遠gfi 2014-3-15 23:37
最近在学matlab编程,可是没发现它的代码比c语言短啊 MATLAB论坛 吟啸长空 2012-5-28 4 1690 qylj530 2012-5-29 22:43
很不错的C语言入门课件 attachment C/C++ 心口疼 2012-6-16 4 2537 shaox 2012-6-24 17:07
请教关于LINGO和C语言混合编程的问题 LINDO\LINGO论坛 Ayinuo 2012-7-20 5 2924 七月sanger 2016-12-5 11:52
数据结构(严蔚敏C语言版)习题集 attachment C/C++ wangxun2010 2012-8-11 7 3356 lz19780510 2012-11-21 18:28
公交路线最小转乘次数的路径选择算法(C程序代码)(请求仁兄指导) 数模问题互助 舞情_Dong 2012-8-19 0 1911 舞情_Dong 2012-8-19 17:58
公交路线最小换乘次数的路径选择算法(C代码)(请求高手指教) 数模经验分享 舞情_Dong 2012-8-19 3 4170 倦了流年 2014-7-14 00:29
如何用matlab调用c语言 数模问题互助 梦溪517 2012-8-28 4 2132 thinkercui 2012-8-29 20:59
C语言 - [!price! 2 点体力] attachment C/C++ persist..... 2012-9-24 8 2835 建不了的模型 2012-12-29 13:33
人大经济论坛诚聘latex/mathematica/C语言/photoshop软件培训老师 数模求职招聘 20121111 2012-11-15 0 130 20121111 2012-11-15 10:49
C语言设计界面 开源分享 ottiou 2012-12-9 0 10951 ottiou 2012-12-9 20:17

相关日志

分享 为什么C语言屹立不倒?
sdccumcm 2013-6-12 11:45
有些语言诞生几十年了依然是世界上最流行的语言,比如C语言。有些语言虽然号称新兴的语言却很少有人使用。在编程语言这个领域里似乎不符合长江后浪推前浪这个规律。这恐怕不止语言本身的因素,里面的缘由值得研究者好好去探索一番。 近年来,谷歌一直致力于开发出自己的编程语言以取代当今世上最常用的C、C++和JavaScript。在系统语言方向,谷歌的Go语言能够为用户在数据中心内建立大型软件提供更多的便捷,有望取代C语言和C++的地位;而在网络开发方面,谷歌希望凭借Dart取代JavaScript。编程语言的世界里可谓是江山代有人才出,可有那么一位引领**达数十年之久,它就是C语言。 编程语言之间的竞争一天也没能停歇,长江后浪推前浪,一代更比一代强。它们之中只有屈指可数的少数能够被市场接纳,成为程序员们日日夜夜的伴侣。究竟怎样的编程语言才能够成为大浪淘沙中的幸运儿?普林斯顿大学(Princeton)和加州大学伯 克利分校(University of California at Berkeley)的研究者雷欧·马耶若维奇(Leo Meyerovich)和阿里·拉布金(Ari Rabkin)希望通过自己的研究,来解开编程语言世界的丛林法则。他们在探寻一个问题——为何C语言虽垂垂老矣却能屹而不倒? 雷欧和阿里采访了数以万计的程序员,又在全球最大的软件仓库SourceForge梳理了超过30万份的程序。“为什么C语言没有被淘汰?”拉布金提出了这个问题。的确,C语言距问世之初已经有了35年的历史。在这期间里,计算机迈出了不可测量的发展步伐,软件和操作系统也早就今非昔比,编程语言中不乏叱咤风云的新生代,而C语言也有了升级版。即便如此,C语言依旧风采不减当年。 拉布金刚刚取得了加州大学伯克利分校的计算机博士学位,如今在普林斯顿大学攻读博士后学位。“在学术领域,现今的趋势是解决那些尚未出现的难题,”拉布金说,“学者们希望能够标新立异地建立起一个全新的语言系统,就没有考虑这么一套编程语言是否有实践的价值。编程语言的开发者们缺少一个明确的目标。”他指出,有些编程语言甚至缺失了最基础的东西,比如文档(Documentation);还有些开发者不停地在语言系统上画蛇添足,弄到最后搞的程序员们只能因为它太“丰富”了不得不放弃。马耶若维奇认为:“我们发现这个问题事实上不是一个技术领域的问题,它是因为整个学术界不够注重实践需求所造成的”。 新兴编程语言Scale是一个很好的例子。数据分析机构Slice-Data的创始人之一张洋(音译)是Scale众多使用者中的一员,他从2006年起开始接触Scale。Scale在问世之初文件编制就存在很大的缺陷,这给用户的学习使用造成了很大的不便和痛苦。“我当时肯定是个受虐狂。”他回忆道。 除却新兴语言本身的问题,这里面还有一个要素是程序员的学习能力。试验中收集的信息表明,因为学习新语言太辛苦困难了,程序员们在使用一款新型的编程语言前并不会认认真真地去学习一番。马耶若维奇拿Adobe公司开发的ActionScript作为例子。ActionScript是一款以用户为导向的编程语言,程序员们普遍认为ActionScript的使用比较简单。可是当要用ActionScript做新的事时,比如从媒体开发转向游戏开发,因为没有系统的学习过,他们就束手无策了。 我们普遍认为,程序员年龄越大,经验就越老道,掌握的语言就越多。事实又是怎样的呢?雷欧和阿里在试验中发现,多数程序员都掌握了3至4种程序语言,但当他们到了35-40岁时,很多人就会步入管理岗位。脱离了编程一线,学习新语言的动机和机会就大打折扣了。 马耶若维奇认为,他们正在研究的这个课题十分重要,关乎整个行业是否能够高速和健康地发展。他和拉布金把实验数据都发布在网络上,希望他人能够给出新的视角,同时为如何解决这一问题提供建议与帮助。
203 次阅读|0 个评论
分享 c语言的delay函数在C++中的应用代替
菲克 2012-5-15 12:44
#include time.h #include stdio.h void delay(int); int main(void) { clock_t start, end; start = clock(); delay(10); end = clock(); printf("The time was:%d\n", (end-start)/CLOCKS_PER_SEC); printf("%d\n%d\n%d\n", start, end, CLOCKS_PER_SEC); return 0; } void delay(int sec) { time_t start_time, cur_time; // 变量声明 time(start_time); do { time(cur_time); } while((cur_time - start_time) sec ); }
388 次阅读|0 个评论
分享 连连看游戏(c语言实现)
水木淋溪 2012-5-4 16:50
经典的连连看游戏。 程序作者:水木淋溪 577712541@qq.com 游戏运行截图如下: 游戏中使用了资源文件, 点这里下载该游戏的完整 VC 项目包 。 游戏主代码如下(相关图片资源请下载完整 VC 项目包): /////////////////////////////////////////////////// // 程序名称:连连看 // 编译环境:Visual C++ 6.0 / 2012,EasyX 20120501(beta) // 作  者:水木淋溪 577712541@qq.com // 最后修改:2012-4-28 // 注:本游戏可以说是网上一个游戏的复制 // 但是是用自己的思想编制的(生成算法有参考) // 游戏的优点我就不多说了,玩的过的人都知道 // 游戏缺点:音乐、背景选的不好,只有一关,很传统··· // 没有计时,没有提示,没有自动完成··· // 总之是有待完成,不过这些代码是核心 ////////////////////////////////////////////////// #include graphics.h #include conio.h #include time.h #include stdio.h #include windows.h #pragma comment(lib,"winmm.lib") //150 150 12 7 21 易 //60 100 16 9 32 中 //100 120 14 8 28 难 #define leftedge 150 //游戏区距左边框距离 #define topedge 150 //游戏区距上边框距离 #define COL 12 //游戏区列数 #define ROW 7 //游戏区行数 #define GridNum 21 //游戏图片数目 #define GridW 42 //游戏图片的长 #define GridH 48 //游戏图片的宽 #define N 555 //开屏大小(宽) #define M 785 //开屏大小(长) IMAGE image ; //图片库 IMAGE image2; //填充图片 int GridID ; //游戏图纸 MOUSEMSG mouse; //记录鼠标信息 struct GridInfor //记入击中图片信息 { int idx,idy; //图纸坐标 int leftx,lefty; //屏幕坐标 int GridID; //图片类型 }pre,cur,dur; struct //记录连线点 { int x; int y; }point ; static int pn; //记录连线点个数 void InitFace (); //初始化界面 void Shuffle (); //随即打乱图片 void ShowGrid (); //显示图片 void RandGrid (); //绘制地图 void Link (); //连接两图 void Des_direct (); //直接相消 void Des_one_corner(); //一折相消 void Des_two_corner(); //两折相消 void Load_picture (); //加载图片 void Init_Grid (GridInfor pre); //初始化格子信息 void Leftbottondown (MOUSEMSG mouse); //实现鼠标左击效果 void Draw_frame (int leftx,int lefty); //绘制边框 void Mousemove (int leftx,int lefty); //实现鼠标移动效果 bool Judg_val (int leftx,int lefty); //判断鼠标是否在游戏区 void SeleReact (int leftx,int lefty); //显示选中效果 void TranstoPhycoor (int* idx,int* idy); //图纸坐标转变为屏幕坐标 void GridPhy_coor (int leftx,int lefty); //规范物理坐标 void iPaint (long x1,long y1,long x2,long y2); //将直线销毁 void DrawLine (int x1,int y1,int x2,int y2) ; //用直线连接两图 bool DesGrid (GridInfor pre,GridInfor cur); //判断两者是否能相消 bool Match_direct (POINT ppre,POINT pcur); //判断两者是否能够直接相消 bool Match_one_corner (POINT ppre,POINT pcur); //判断两者是否能一折相消 bool Match_two_corner (POINT ppre,POINT pcur); //判断两者是否能两折相消 void ExchaVal (GridInfor pre,GridInfor cur); //交换图片信息 bool Single_click_judge (int mousex,int mousey); //判断单击是否有效 void RecordInfor (int leftx,int lefty,GridInfor grid); //记录选中的信息 void TranstoDracoor (int mousex,int mousey,int *idx,int *idy); //鼠标坐标转化为图纸坐标 void Explot (POINT point,int *left,int *right,int *top,int *bottel);//探索point点附近的空位置 void main() { initgraph(M,N); mciSendString("play game_begin.mp3 repeat", NULL, 0, NULL); InitFace(); while(1) { mouse = GetMouseMsg(); switch(mouse.uMsg) { case WM_MOUSEMOVE: Mousemove(mouse.x,mouse.y); break; case WM_LBUTTONDOWN: if(Single_click_judge(mouse.x,mouse.y)) { Leftbottondown(mouse); } break; default: break; } } closegraph(); } ////////////////////////////////////////生成操作////////////////////////////// void RandGrid() //产生图片的标记 { for(int iCount = 0, x = 1; x = ROW; ++x ) { for( int y = 1; y = COL; ++y ) { GridID = iCount++ % GridNum + 1; } } } void Shuffle( ) //打乱棋盘 { int ix, iy, jx, jy, grid; for( int k = 0; k 84; ++k ) { ix = rand() % ROW + 1; // 产生 1 - COL 的随机数 iy = rand() % COL + 1; // 产生 1 - ROW 的随机数 jx = rand() % ROW + 1; // 产生 1 - COL 的随机数 jy = rand() % COL + 1; // 产生 1 - ROW 的随机数 if( GridID != GridID ) //如果不相等就交换数据 { grid = GridID ; GridID = GridID ; GridID = grid; } } } ////////////////////////////////初始化界面/////////////////////////////////////// void InitFace() { srand((unsigned)time(NULL)); Load_picture(); RandGrid(); IMAGE image3; loadimage(image3,"res\\bg.bmp"); putimage(0,0,image3); getimage(image2,3 * 42,2 * 48,42, 48); Shuffle(); ShowGrid(); } void Load_picture() //加载图片 { IMAGE image1,background; loadimage(image1,"IMAGE","grids"); SetWorkingImage(image1); for(int i = 1 ;i GridNum + 1 ;i ++) for(int j = 0;j 2;j++) getimage(image ,j * 42,i * 48,42, 48); loadimage(background,"IMAGE","bg"); SetWorkingImage(background); getimage(image2,3 * 42,2 * 48,42, 48); SetWorkingImage(); putimage(0,0,background); } void ShowGrid() { int idx,idy; for(int i = 0 ;i ROW; i ++) for(int j = 0 ;j COL ; j++) { idy = i * 48 + topedge ,idx = j * 42 + leftedge; putimage(idx,idy,image ] ); } } /////////////////////////////////鼠标操作//////////////////////////////////////// void Mousemove (int leftx,int lefty) //鼠标移动时的变化 { static int prex,prey,preidx,preidy, curidx,curidy; if(Judg_val(leftx,lefty)) { TranstoDracoor(leftx,lefty,curidx,curidy); //转化为图纸坐标 if(GridID != 0) { GridPhy_coor(leftx,lefty); if(pre.idx == preidx pre.idy == preidy) putimage(prex,prey,image ] ); else putimage(prex,prey,image ] ); prex = leftx, prey = lefty; preidx = curidx, preidy = curidy; Draw_frame(leftx,lefty); //绘制边框 } } } void Leftbottondown (MOUSEMSG mouse) //左击时的变化 { static int click = 0, idx,idy; click++; SeleReact (mouse.x,mouse.y); //显示选中效果 if(click == 1) RecordInfor(mouse.x,mouse.y,pre); if(click == 2) { TranstoDracoor (mouse.x,mouse.y,idx,idy); if(idx != pre.idx || idy != pre.idy) { RecordInfor (mouse.x,mouse.y,cur); if(pre.GridID == cur.GridID DesGrid(pre,cur)) { GridID = GridID =0; Link (); pn = 0; putimage(pre.leftx,pre.lefty,image2); putimage(cur.leftx,cur.lefty,image2); Init_Grid(pre); Init_Grid(cur); click = 0; } else { ExchaVal(dur,pre); ExchaVal(pre,cur); Init_Grid(cur); click = 1; putimage(dur.leftx,dur.lefty,image ] ); } } else click = 1; } } void SeleReact (int leftx,int lefty) //选中时效果 { if(Judg_val(leftx,lefty)) { int idx,idy; TranstoDracoor (leftx,lefty,idx,idy); GridPhy_coor (leftx,lefty); putimage(leftx,lefty,image ] ); } } bool Judg_val(int leftx,int lefty) //判断鼠标是否在游戏区 { return leftx leftedge leftx leftedge + GridW * COL lefty topedge lefty topedge + GridH * ROW; } void TranstoDracoor (int mousex,int mousey ,int *idx,int *idy) //鼠标坐标转化为图纸坐标 { if(Judg_val(mousex,mousey)) { *idx = (mousex - leftedge) / 42 + 1; *idy = (mousey - topedge) / 48 + 1 ; } } void RecordInfor(int leftx,int lefty,GridInfor grid) //记录选中的信息 { TranstoDracoor(leftx,lefty,grid.idx,grid.idy); grid.leftx = (grid.idx - 1) * 42 + leftedge; grid.lefty = (grid.idy - 1) * 48 + topedge; grid.GridID = GridID ; } bool Single_click_judge (int mousex,int mousey) //判断单击是否有效 { int idx,idy; TranstoDracoor (mousex,mousey,idx,idy); //转化为图纸坐标 if(Judg_val(mouse.x,mouse.y) GridID != 0) return true; return false; } void Draw_frame(int leftx,int lefty) //绘制方框 { setcolor(RGB(126,91,68)); setlinestyle(PS_SOLID,NULL,1); rectangle(leftx,lefty,leftx+41,lefty+47); rectangle(leftx + 2,lefty + 2,leftx+39,lefty+45); setcolor(RGB(250,230,169)); rectangle(leftx + 1,lefty + 1,leftx+40,lefty+46); } ////////////////////////////////判断消除操作///////////////////////////////////// bool DesGrid (GridInfor pre,GridInfor cur) //判断两者是否能相消 { bool match = false; POINT ppre,pcur; ppre.x = pre.idx; ppre.y = pre.idy; pcur.x = cur.idx; pcur.y = cur.idy; if(Match_direct(ppre,pcur)) match = true; else if(Match_one_corner(ppre,pcur)) match = true; else if(Match_two_corner(ppre,pcur)) match =true; return match; } bool Match_direct(POINT ppre,POINT pcur) //判断两者是否能够直接相消 { int k,t; if(ppre.x == pcur.x) { k = ppre.y pcur.y ? ppre.y : pcur.y; t = ppre.y pcur.y ? ppre.y : pcur.y; if(t + 1 == k) goto FIND; for(int i = t + 1;i k ;i++) if(GridID != 0) return false; if(i == k) goto FIND; } else if(ppre.y == pcur.y) { k = ppre.x pcur.x ? ppre.x : pcur.x; t = ppre.x pcur.x ? ppre.x : pcur.x; if(t + 1 == k) goto FIND; for(int i = t + 1;i k ;i++) if(GridID != 0) return false; if(i == k) goto FIND; } return false; FIND: point .x = pcur.x, point .y = pcur.y; pn++; point .x = ppre.x, point .y = ppre.y; pn++; return true; } bool Match_one_corner(POINT ppre,POINT pcur) //判断两者是否能一折相消 { int left,right,top,bottel,x = ppre.x,y = ppre.y; Explot(ppre,left,right,top,bottel); ppre.y = top - 1; RESEARCHX: if(ppre.y bottel) ppre.y++; else goto BACK; if(Match_direct(ppre,pcur)) goto FIND; else goto RESEARCHX; BACK: ppre.y = y; ppre.x = left - 1; RESEARCHY: if(ppre.x right) ppre.x++; else goto REBACK; if(Match_direct(ppre,pcur)) goto FIND; else goto RESEARCHY; REBACK: pn = 0; return false; FIND: point .x = x,point .y = y,pn++; return true; } bool Match_two_corner(POINT ppre,POINT pcur) //判断两者是否能两折相消 { int left,right,top,bottel,x = ppre.x,y = ppre.y; Explot(ppre,left,right,top,bottel); ppre.y = top - 1; RESEARCHX: if(ppre.y bottel) ppre.y++; else goto BACK; if(Match_one_corner(ppre,pcur)) goto FIND; else goto RESEARCHX; BACK: ppre.y = y; ppre.x = left - 1; RESEARCHY: if(ppre.x right) ppre.x++; else goto REBACK; if(Match_one_corner(ppre,pcur)) goto FIND; else goto RESEARCHY; REBACK: pn = 0;return false; FIND: point .x = x,point .y = y,pn++; return true; } void Explot(POINT point,int *left,int *right,int *top,int *bottel) { int x = point.x,y = point.y; x++; while(x = COL + 1 GridID == 0) x++; *right = x - 1; x = point.x; x--; while(x = 0 GridID == 0) x--; *left = x + 1; x = point.x; y++; while(y = ROW + 1 GridID == 0) y++; *bottel= y - 1; y = point.y; y--; while(y = 0 GridID == 0) y--; *top = y + 1; } /////////////////////////////////消除操作//////////////////////////////////////// void Link () { switch(pn) { case 2: Des_direct(); break; case 3: Des_one_corner(); break; case 4: Des_two_corner(); break; default : break; } } void Des_direct () { TranstoPhycoor(point .x,point .y); TranstoPhycoor(point .x,point .y); DrawLine(point .x,point .y,point .x,point .y); Sleep(250); iPaint(point .x,point .y,point .x,point .y); } void Des_one_corner() { TranstoPhycoor(point .x,point .y); TranstoPhycoor(point .x,point .y); TranstoPhycoor(point .x,point .y); DrawLine(point .x,point .y,point .x,point .y); DrawLine(point .x,point .y,point .x,point .y); Sleep(250); iPaint(point .x,point .y,point .x,point .y); iPaint(point .x,point .y,point .x,point .y); } void Des_two_corner() { TranstoPhycoor(point .x,point .y); TranstoPhycoor(point .x,point .y); TranstoPhycoor(point .x,point .y); TranstoPhycoor(point .x,point .y); DrawLine(point .x,point .y,point .x,point .y); DrawLine(point .x,point .y,point .x,point .y); DrawLine(point .x,point .y,point .x,point .y); Sleep(250); iPaint(point .x,point .y,point .x,point .y); iPaint(point .x,point .y,point .x,point .y); iPaint(point .x,point .y,point .x,point .y); } void DrawLine (int x1,int y1,int x2,int y2) { setlinestyle(PS_SOLID,NULL,3); setcolor(RGB(90,43,9)); line(x1 + 21,y1 + 24,x2 + 21,y2 + 24); } void iPaint (long x1,long y1,long x2,long y2) { int minx,miny,maxx,maxy; if(x1 == x2) { maxy = y1 y2? y1:y2; miny = y1 y2? y1:y2; for(int i = miny; i = maxy;i += 48) putimage(x1,i,image2); } else if(y1 == y2) { maxx = x1 x2? x1:x2; minx = x1 x2? x1:x2; for(int j = minx; j = maxx;j += 42 ) putimage(j,y1,image2); } } ///////////////////////////////////////////////////////////////////////////////// void GridPhy_coor(int leftx,int lefty) //转化为标准物理坐标 { leftx = ((leftx - leftedge) / 42) * 42 + leftedge; lefty = ((lefty - topedge) / 48) * 48 + topedge; } void ExchaVal(GridInfor pre,GridInfor cur) //交换格子信息 { pre.GridID = cur.GridID; pre.idx = cur.idx;pre.idy = cur.idy; pre.leftx = cur.leftx;pre.lefty = cur.lefty; } void Init_Grid(GridInfor grid) //初始化格子 { grid.GridID = 0; grid.idx = 0; grid.idy = 0; grid.leftx = 0; grid.lefty = 0; } void TranstoPhycoor (int* idx,int* idy) //图纸坐标转变为屏幕坐标 { int x ,y;x =*idx,y = *idy; *idy = (y - 1) * 48 + leftedge; *idx = (x - 1) * 42 + topedge; } ///////////////////////////////////end//////////////////////////////////////////
个人分类: 编程小游戏|471 次阅读|0 个评论
qq
收缩
  • 电话咨询

  • 04714969085

关于我们| 联系我们| 诚征英才| 对外合作| 产品服务| QQ

手机版|Archiver| |繁體中文 手机客户端  

蒙公网安备 15010502000194号

Powered by Discuz! X2.5   © 2001-2013 数学建模网-数学中国 ( 蒙ICP备14002410号-3 蒙BBS备-0002号 )     论坛法律顾问:王兆丰

GMT+8, 2025-11-8 05:39 , Processed in 0.291536 second(s), 27 queries .

回顶部