论坛交流
首页办公自动化| 网页制作| 平面设计| 动画制作| 数据库开发| 程序设计| 全部视频教程
应用视频: Windows | Word2007 | Excel2007 | PowerPoint2007 | Dreamweaver 8 | Fireworks 8 | Flash 8 | Photoshop cs | CorelDraw 12
编程视频: C语言视频教程 | HTML | Div+Css布局 | Javascript | Access数据库 | Asp | Sql Server数据库Asp.net  | Flash AS
当前位置 > 文字教程 > C语言程序设计教程
Tag:新手,函数,指针,数据类型,对象,Turbo,入门,运算符,数组,结构,二级,,tc,游戏,试题,问答,编译,视频教程

设计彩色框的C源程序

文章类别:C语言程序设计 | 发表日期:2008-9-24 14:45:07

/*
*
* Short driver module
*
*/

main()
{
clrscr();
box(1,1,23,79);
box(2,2,21,77);
box(3,3,19,75);
box(4,4,17,73);
box(5,5,15,71);
box(6,6,13,69);
box(7,7,11,67);
box(8,8,9,65);
box(9,9,7,63);
box(10,10,5,61);
box(11,11,3,59);
box(12,12,1,57);
poscur(24,1);
}

/************************************************************
* BOX *
*----------------------------------------------------------*
* Written by: Jeff Ebert 7/01/87 *
* Modified by: xxxxxxxxxx *
* *
* Please modify me! *
* Possible Enhancements include but are not limited to: *
* 1) Variable box character styles [1 line or 2] *
* 2) Error checking *
* 3) Color options *
* *
* *
* This function builds a simple double frame for a menu. *
* The function is passed the parameters for the upper *
* left corner row, upper left corner column the height *
* of the frame and the width. *
* *
************************************************************/
#include

#define ULCOR 201
#define URCOR 187
#define LLCOR 200
#define LRCOR 188
#define VBAR 186
#define HBAR 205
#define ESC 27


box(row, col, hgt, wdth)
int row, col, hgt, wdth;

{
int x, y;

poscur(row,col);
putchar(ULCOR);
for(x = col + 1; x <=(col + wdth -1); x++)
putchar(HBAR);
putchar(URCOR);

for(x = row + 1; x <=(row + hgt - 1); x++){
poscur(x,col);
putchar(VBAR);
poscur(x,col+wdth);
putchar(VBAR);
}
poscur(x,col);
putchar(LLCOR);
for(x= col + 1; x <=(col + wdth -1); x++)
putchar(HBAR);
putchar(LRCOR);
}

/********************************************************
* POSCUR *
*------------------------------------------------------*
* This function positions the cursor at the specified *
* x,y coordinate. It uses the ANSI standard ESCAPE *
* sequence to produce the desired effect. Its not the *
* fastest way to position the cursor, but perhaps the *
* most portable. *
* *
********************************************************/
poscur(xcor,ycor)
int xcor,ycor;
{
printf("%c[%d;%dH",ESC,xcor,ycor);
}


/********************************************************
* CLRSCR *
*------------------------------------------------------*
* This function positions the cursor at the specified *
* x,y coordinate. It uses the ANSI standard ESCAPE *
* sequence to produce the desired effect. Its not the *
* fastest way to position the cursor, but perhaps the *
* most portable. *
* *
********************************************************/
clrscr()
{
printf("%c[2J",ESC);
}

上一篇:{应用}正确使用指针 人气:4681
下一篇:{应用}指针详解-01 人气:4996
视频教程列表
文章教程搜索
 
C语言程序设计推荐教程
C语言程序设计热门教程
看全部视频教程
购买方式/价格
购买视频教程: 咨询客服
tel:15972130058