易截截图软件、单文件、免安装、纯绿色、仅160KB

turbo C 下的打字游戏

在这里贴上最近自己忙活的用turbo C编写的“打字游戏”的源代码:
#include<graphics.h>
#include<conio.h>
#include<STDLIB.h>
#include<dos.h>
#define BK_COLOR BLACK
#define CHAR_COLOR WHITE
#define C_COLOR BLUE
#define num 10
#define SPEED 3000
#define Esc 27
#define MenuX 200
#define MenuY 110
#define MenuWidth 200
#define MenuSinH 40
#define ChoiceX MenuX+15
#define ChoiceY MenuY+10
#define ChoiceWidth 170
#define ChoiceH 25
#define UpKey 72
#define DownKey 80
#define Enter 13
void  Choice(int c_x,int c_y,int color)
{
 setfillstyle(1,color);
 bar(c_x,c_y,c_x+ChoiceWidth,c_y+ChoiceH);
}
void Main_Menu()
{
 settextstyle(0,0,2);
 outtextxy(MenuX+20,MenuY+15,"Start Game");
 outtextxy(MenuX+20,MenuY+MenuSinH+15,"Game Steup");
 outtextxy(MenuX+40,MenuY+2*MenuSinH+15,"Exit");
}
void Option_Menu()
{
 settextstyle(0,0,2);
 outtextxy(MenuX+20,MenuY+15,"beginner");
 outtextxy(MenuX+20,MenuY+MenuSinH+15,"advancer");
 outtextxy(MenuX+40,MenuY+2*MenuSinH+15,"senior");
}
int ChooseMenu(int flag)
{
 int x,y;
 char C_key;
 x=ChoiceX;y=ChoiceY;
 do
 {
  kbhit();
  C_key=getch();
  if(C_key==Esc)
   return Esc;
  else
   if(C_key==Enter)
    return y;
  else
  switch(C_key)
  {
  case UpKey:
   if(y==ChoiceY)
    break;
   else
   {
    Choice(x,y,BK_COLOR);
    y-=MenuSinH;
    Choice(x,y,C_COLOR);
   }
   break;
  case DownKey:
   if (y==ChoiceY+2*MenuSinH)
    break;
   else
   {
    Choice(x,y,BLACK);
    y+


相关文档:

DAY3|编个"hello world"的C程序先~

今天要编个最简单的"hello world"的C程序,算是初步感受下Linux中的编程环境,涉及以下3个步骤:
1. 先在"vim"里编写源文件;
2. 然后再用"gcc"编译生成"hello"的可执行文件;
3. 运行"hello",看看效果。
那么开始吧!
1. vim
vim hello.c
i
#include <stdio.h>
int
main (void)
{
printf ("hello.\n" ......

s3c2440基于linux的gpio led字符设备驱动实践

 今天完成了嵌入式linux的第一个驱动的编写和测试,虽然是个简单的程序,但是麻雀虽小,五脏俱全,希望可以给刚开始接触驱动编写的人一些提示,共同进步。
源代码:
分析如下:
      下面是我的驱动程序:
#include <linux/config.h>//配置头文件
#include <linux/kernel.h&g ......

C/C++数组名与指针区别深入探索

(1)
数组名的内涵在于其指代实体是一种数据结构,这种数据结构就是数组;
(2)
数组名的外延在于其可以转换为指向其指代实体的指针,而且是一个指针常量;
(3)
指向数组的指针则是另外一种变量类型(在WIN32平台下,长度为4),仅仅意味着数组的存放地址
(4)
数组名作为函数形参时,在函数体内,其失去了本身的内涵 ......

c/c++强制类型转换

 Q:什么是C风格转换?什么是static_cast, dynamic_cast 以及 reinterpret_cast?区别是什么?为什么要注意?
A:转换的含义是通过改变一个变量的类型为别的类型从而改变该变量的表示方式。为了类型转换一个简单对象为另一个对象你会使用传统的类型转换操作符。比如,为了转换一个类型为doubole的浮点数的指针到整型: ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号