. : : Assembly Language : : .  |  首页  |  我提出的问题  |  我参与的问题  |  我的收藏  |  消息中心   |  游客  登录  | 
刷新 | 提问 | 未解决 | 已解决 | 精华区 | 搜索 |
  《汇编语言》论坛 ->C/C++语言
  管理员: assembly   [回复本贴] [收藏本贴] [管理本贴] [关闭窗口]
主题 : :  看到一个简单的c图形程序,秀秀  [待解决] 回复[ 18次 ]   点击[ 2613次 ]  
abob
[帖 主]   [ 发表时间:2009-04-06 17:41 ]   [引用]   [回复]   [ top ] 
荣誉值:169
信誉值:0
注册日期:2008-08-19 16:07
/*  
   3DBX.C 画立体块  
*/   
#include "conio.h"    
#include "graphics.h"    
   
void InitGra(void);   
void FillScr(void);   
void Intfac1(void);   
void Intfac2(void);   
void Intfac3(void);   
void Intfac4(void);   
void Box1(int x, int y, int l, int h);   
void Box2(int x, int y, int l, int h);   
void Box3(int x, int y, int l, int h);   
void Box4(int x, int y, int l, int h);   
   
int main(void)   
{   
    InitGra();   
    FillScr(); Intfac1();    
    getch();   
    FillScr(); Intfac2();   
    getch();   
    FillScr(); Intfac3();   
    getch();   
    FillScr(); Intfac4();   
    getch();   
    closegraph() ;     return(0);   
}   
   
void InitGra(void)   
{   
   int GraphMode, DraphDrive = DETECT;   
   registerbgidriver(EGAVGA_driver) ;   
   initgraph(&DraphDrive, &GraphMode, "") ;   
}   
   
void FillScr(void)   
{   
   setfillstyle(1, 7);   
   bar(0, 0, 639, 479);   
}   
   
void Intfac1(void)   
{   
    int x, y, l, h, i, j;   
    y = 5;   
    l = 45; h = 25;   
    for (j = 0; j < 13; j++)   
    {   
       x = 6;   
       for (i = 0; i < 11; i++)   
       {   
      Box1(x, y, l, h);   
      x = x+l+13;   
       }   
       y = y+h+12;   
    }   
}   
   
void Intfac2(void)   
{   
    int x, y, l, h, i, j;   
    y = 5;   
    l = 45; h = 25;   
    for (j = 0; j < 13; j++)   
    {   
       x = 6;   
       for (i = 0; i < 11; i++)   
       {   
      Box2(x, y, l, h);   
      x = x+l+13;   
       }   
       y = y+h+12;   
    }   
}   
   
void Intfac3(void)   
{   
    int x = 0, y = 16;   
    int l = 639, h = 50;   
    int i;     for (i = 0; i < 6; i++)   
    {   
       Box3(x, y, l, h);   
       y = y+h+40;   
    }   
}   
   
void Intfac4(void)   
{   
    int x = 0, y = 16;   
    int l = 639, h = 50;   
    int i;     for (i = 0; i < 6; i++)   
    {   
       Box4(x, y, l, h);   
       y = y+h+40;   
    }   
}   
   
void Box1(int x, int y, int l, int h)   
{   
    setcolor(15);   
    line(x, y, x+l, y);   
    line(x, y, x, y+h);   
    setcolor(8);   
    line(x+l, y+h, x+l, y);   
    line(x+l, y+h, x, y+h);   
}   
   
void Box2(int x, int y, int l, int h)   
{   
    setcolor(8);   
    line(x, y, x+l, y);   
    line(x, y, x, y+h);   
    setcolor(15);   
    line(x+l, y+h, x+l, y);   
    line(x+l, y+h, x, y+h);   
}   
   
void Box3(int x, int y, int l, int h)   
{   
    setcolor(15);   
    line(x, y, x+l, y);   
    line(x+1, y+1, x+l-1, y+1);   
    setcolor(8);   
    line(x, y+h, x+l, y+h);   
    line(x, y+h-1, x+l, y+h-1);   
}   
void Box4(int x, int y, int l, int h)   
{   
    setcolor(8);   
    line(x, y, x+l, y);   
    line(x+1, y+1, x+l-1, y+1);   
    setcolor(15);   
    line(x, y+h, x+l, y+h);   
    line(x, y+h-1, x+l, y+h-1);
}
mess
[第1楼]   [ 回复时间:2009-04-07 10:09 ]   [引用]   [回复]   [ top ] 
荣誉值:337
信誉值:0
注册日期:2008-01-01 17:48
不错,踩踩~
zjj2186
[第2楼]   [ 回复时间:2009-06-15 21:04 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2009-05-05 20:07
在什么编译器下用?vc6.0不能用 没graphics.h这个头文件
jinme
[第3楼]   [ 回复时间:2009-07-04 11:42 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2009-07-04 00:21
tc3link错误!
moyan
[第4楼]   [ 回复时间:2009-07-11 16:17 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2009-06-08 14:18
我昏,C版本太多了,我都不知道这是写的啥,找个运行环境都是问题
mess
[第5楼]   [ 回复时间:2009-07-14 11:21 ]   [引用]   [回复]   [ top ] 
荣誉值:337
信誉值:0
注册日期:2008-01-01 17:48
我用的tc2.0,编译运行没问题~

要编译注意的是void InitGra(void),是要去找相应的BGI文件的,网上搜索一下很容易找到的~
xiliang
[第6楼]   [ 回复时间:2009-10-03 09:06 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2009-02-27 11:56
有用,挺
handsome
[第7楼]   [ 回复时间:2009-11-14 09:35 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2009-11-13 23:22
那个头文件规定了它只能在T环境下运行
sinawear
[第8楼]   [ 回复时间:2009-12-24 00:56 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:5
注册日期:2009-03-25 17:31
good!
kaogushiguang
[第9楼]   [ 回复时间:2009-12-27 10:04 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2009-11-14 16:04
我用TC2.0 编译的 可是却出错了 LINKER ERROR: UNDEFINED SYMBOL'_EGAVGA_DRIVER'IN MODULE 3.C
kaogushiguang
[第10楼]   [ 回复时间:2009-12-27 10:05 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2009-11-14 16:04
3.C 是我那个文件名
zys789741
[第11楼]   [ 回复时间:2010-04-09 11:43 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2010-03-15 13:03
大哥啊,tc没几个人用啊
liufly0
[第12楼]   [ 回复时间:2010-04-15 19:19 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2010-04-15 19:11
e:\c c\2\2.cpp(2) : fatal error C1083: Cannot open include file: 'graphics.h': No such file or directory
liufly0
[第13楼]   [ 回复时间:2010-04-15 19:19 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2010-04-15 19:11
e:\c c\2\2.cpp(2) : fatal error C1083: Cannot open include file: 'graphics.h': No such file or directory
luomuhanxue
[第14楼]   [ 回复时间:2010-05-04 18:32 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2009-06-03 21:18
9楼的把这句 registerbgidriver(EGAVGA_driver) ;  注掉就ok了!
willapple
[第15楼]   [ 回复时间:2010-07-15 16:32 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2010-07-15 16:28
学习啦!很好!
2012001721
[第16楼]   [ 回复时间:2015-11-21 21:59 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2015-11-21 20:46
运行出来了,感觉不错,学习了。
somniumchase
[第17楼]   [ 回复时间:2021-01-01 11:48 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2021-01-01 11:33
我vc没有那个头文件
需要登录后才能回帖 -->> 请单击此处登录
    Copyright © 2006-2024   ASMEDU.NET  All Rights Reserved