怎样把这个函数加到编译系统里啊 在线等 急!!!!!!!!!!

sea373 2004-01-03 10:54:17
我在visualc++里 画图 缺少这个函数

我把这个函数直接加到bin里面

好象不行

为什么啊

该怎么做

在线等 急!!!!!!!!!

先谢谢
...全文
171 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
caesar22 2004-01-03
  • 打赏
  • 举报
回复
在VC中作图????WIN32 API里面有那么多的图形函数你怎么不用?不够了,还有DX,还有OPEN GL,还有。。那么多的东西嘛。。。。
不过我都不会。。。呵呵。
cadinfo 2004-01-03
  • 打赏
  • 举报
回复
不行,<graphics.h>是TC在DOS下的图形模式,VC中对图形处理采用了DC的概念,因此操作系统的不同导致方法不同,当然你在dos shell下面可以仍然使用tc编写此类程序。
lambochan 2004-01-03
  • 打赏
  • 举报
回复
VC也支持硬件操作..一堆视频函数,除了DX,就数它了..

VC用DOS?<graphics.h>?
soulz 2004-01-03
  • 打赏
  • 举报
回复
VC 里面用MFC?
handpoint 2004-01-03
  • 打赏
  • 举报
回复
<graphics.h>是Borland的C系列的头文件,以前在Turbo C中有用过,具体的原理是
在DOS下对显卡进行直接写屏操作,在VC中没有这个对应的头文件,而且Windows下
应该不可能支持这种直接硬件操作的吧?如果要用的话好是用Borland的系列试试.
不知道说的对不对?见笑
sea373 2004-01-03
  • 打赏
  • 举报
回复
用了tc 不行啊

这个是在vc下编的吧
afc 2004-01-03
  • 打赏
  • 举报
回复
用TC编译
sea373 2004-01-03
  • 打赏
  • 举报
回复
这个是我在网站下载的

该怎么运行 请求指点

谢谢!!!!!!!!!!!!!!
sea373 2004-01-03
  • 打赏
  • 举报
回复
#include <iostream.h>
#include <graphics.h>
#include <time.h>
#include <dos.h>
#include <bios.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#define ENTER 7181
#define ESC 283
#define RIGHT 19712
#define LEFT 19200
#define DOWN 20480
#define UP 18432
#define SPACE 14624
struct box
{
int dig;
int state;
int num;
};
class excrement
{
box allbox[8][8];
public:
static int overif;
void firstshow();
void setexcrement();
void changeshow();
void flag(int,int);
void input(int,int);
friend void movecuror(excrement,int,int);
friend void over(excrement);
};
void excrement::flag(int x,int y)
{
allbox[x][y].dig=-1;
}
void excrement::changeshow()
{
int i,j,k,r,c;
char msg[10];
for(;;)
{
for (k=0,i=0;i<8;i++)
for (j=0;j<8;j++)
{
if (allbox[i][j].dig==1&&allbox[i][j].num==0)
{
for (r=-1;r<=1;r++)
for (c=-1;c<=1;c++)
{
if (((i+r)>=0)&&((i+r)<8)&&((j+c)>=0)&&((j+c)<8))
{
if (allbox[i+r][j+c].dig==0)
{
allbox[i+r][j+c].dig=1;
setcolor(BROWN);

rectangle(100+(i+r)*50+10,30+(j+c)*50+10,100+(i+r+1)*50-10,30+(j+c+1)*50-10);
setfillstyle(SOLID_FILL,BROWN);
floodfill(100+(i+r)*50+30,30+(j+c)*50+30,BROWN);
setcolor(RED);
sprintf(msg,"%d",allbox[i+r][j+c].num);
outtextxy(100+(i+r)*50+20,30+(j+c)*50+20,msg);
k++;
};
};
};
};
};
if (k==0) break;
};
}
void excrement::input(int x,int y)
{
char msg[10];
int sum=0;
if (allbox[x][y].state!=0)
{
overif=1;
return;
}
else
{
if (allbox[x][y].dig!=1)
{
allbox[x][y].dig=1;
};
};
for (int i=0;i<8;i++)
for (int j=0;j<8;j++)
{
if (allbox[i][j].state==1) sum++;
if (allbox[i][j].dig==1) sum++;
};
if (sum==64)
{
overif=2;
return;
};
}
void excrement::setexcrement()
{
int i,j,r,c;
for (i=0;i<8;i++)
{
for (j=0;j<8;j++)
{
allbox[i][j].state=0;
allbox[i][j].num=0;
allbox[i][j].dig=0;
};
};
for (i=0;i<10;)
{
r=rand()%8;
c=rand()%8;
if (allbox[r][c].state!=1)
{
allbox[r][c].state=1;
i++;
};
};
for (i=0;i<8;i++)
for (j=0;j<8;j++)
{
for (r=-1;r<=1;r++)
for (c=-1;c<=1;c++)
{
if (((i+r)>=0)&&((i+r)<8)&&((j+c)>=0)&&((j+c)<8))
if (allbox[i+r][j+c].state==1) allbox[i][j].num++;
};
};
}
void excrement::firstshow()
{
setcolor(YELLOW);
rectangle(96,26,504,434);
setcolor(BROWN);
rectangle(100,30,500,430);
setcolor(LIGHTBLUE);
for (int i=0;i<8;i++)
for (int j=0;j<8;j++)
{

rectangle(100+i*50+10,30+j*50+10,100+(i+1)*50-10,30+(j+1)*50-10);
setfillstyle(SOLID_FILL,getcolor());
floodfill(100+i*50+30,30+j*50+30,getcolor());
};
outtextxy(100,15,"Fuyongtao thanks for your view......");
}
void over(excrement a)
{
for (int i=0;i<8;i++)
for (int j=0;j<8;j++)
{
if(a.allbox[i][j].state!=0)
{
if (a.overif==1)
setcolor(RED);
else
setcolor(GREEN);
circle(100+i*50+25,30+j*50+25,15);
setfillstyle(SOLID_FILL,getcolor());
floodfill(100+i*50+20,30+j*50+20,getcolor());
};
};
outtextxy(68,440,":::::::::::[ENTER] replay:::::::::::[ESC]
quit::::::::::::: ");
}
void movecuror(int,int);
int excrement::overif=0;
int main()
{
excrement play;
int key,xy[2]={0,0};
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}
srand(time(0));
key=ENTER;
for (;key!=ESC;)
{
if (key==ENTER)
{
play.setexcrement();
play.firstshow();
for(;key!=ESC;)
{
//key=bioskey(1);
while((key=bioskey(1))==0) movecuror(play,xy[0],xy[1]);
//key=bioskey(1);
key=bioskey(0);
if (key==LEFT)
{
if (xy[0]>0) xy[0]--;
}
else if (key==RIGHT)
{
if (xy[0]<7) xy[0]++;
}
else if (key==UP)
{
if (xy[1]>0) xy[1]--;
}
else if (key==DOWN)
{
if (xy[1]<7) xy[1]++;
}
else if (key==ENTER)
{
play.input(xy[0],xy[1]);
play.changeshow();
}
else if (key==SPACE)
{
play.flag(xy[0],xy[1]);
/*
setcolor(WHITE);
circle(100+xy[0]*50+25,30+xy[1]*50+25,15);
setfillstyle(SOLID_FILL,getcolor());
floodfill(100+xy[0]*50+20,30+xy[1]*50+20,getcolor());
*/
};
if (play.overif)
{
over(play);
break;
};
};
//for (;key!=ESC;)
};
key=bioskey(1);
if (key==ENTER)
{
play.overif=0;
cleardevice();
};
};
closegraph();
return 1;
}
/*__________________________________________________________________________*/
void movecuror(excrement a,int x,int y)
{
char msg[10];
if (a.allbox[x][y].dig
==-1)
{
//floodfill(100+x*50+30,30+y*50+30,0);
setcolor(0);
rectangle(100+x*50+10,30+y*50+10,100+(x+1)*50-10,30+(y+1)*50-10);
setfillstyle(SOLID_FILL,0);
floodfill(100+x*50+30,30+y*50+30,0);
circle(100+x*50+25,30+y*50+25,15);
setfillstyle(SOLID_FILL,0);
floodfill(100+x*50+20,30+y*50+20,getcolor());
delay(200);
setcolor(LIGHTBLUE);
rectangle(100+x*50+10,30+y*50+10,100+(x+1)*50-10,30+(y+1)*50-10);
setfillstyle(SOLID_FILL,getcolor());
floodfill(100+x*50+20,30+y*50+20,getcolor());
setcolor(WHITE);
circle(100+x*50+25,30+y*50+25,15);
setfillstyle(SOLID_FILL,getcolor());
floodfill(100+x*50+20,30+y*50+20,getcolor());
delay(100);
}
else if(a.allbox[x][y].dig==0)
{
setcolor(0);
rectangle(100+x*50+10,30+y*50+10,100+(x+1)*50-10,30+(y+1)*50-10);
setfillstyle(SOLID_FILL,0);
floodfill(100+x*50+30,30+y*50+30,0);
delay(200);
setcolor(LIGHTBLUE);
rectangle(100+x*50+10,30+y*50+10,100+(x+1)*50-10,30+(y+1)*50-10);
setfillstyle(SOLID_FILL,LIGHTBLUE);
floodfill(100+x*50+30,30+y*50+30,LIGHTBLUE);
delay(100);
}
else
{
setcolor(0);
rectangle(100+x*50+10,30+y*50+10,100+(x+1)*50-10,30+(y+1)*50-10);
setfillstyle(SOLID_FILL,0);
floodfill(100+x*50+30,30+y*50+30,0);
sprintf(msg,"%d",a.allbox[x][y].num);
outtextxy(100+x*50+20,30+y*50+20,msg);
delay(200);
setcolor(BROWN);
rectangle(100+x*50+10,30+y*50+10,100+(x+1)*50-10,30+(y+1)*50-10);
setfillstyle(SOLID_FILL,BROWN);
floodfill(100+x*50+30,30+y*50+30,BROWN);
setcolor(RED);
sprintf(msg,"%d",a.allbox[x][y].num);
outtextxy(100+x*50+20,30+y*50+20,msg);
delay(100);
};
}

-------------------Configuration: xhj - Win32 Debug--------------------
Compiling...
xhj.cpp
f:\121212\msdev98\bin\xhj.cpp(2) : fatal error C1083: Cannot open include file: 'graphics.h': No such file or directory
Error executing cl.exe.

xhj.exe - 1 error(s), 0 warning(s)


sea373 2004-01-03
  • 打赏
  • 举报
回复
那我这个程序该怎么运行啊

这是原程序 和 出现的错误

16,548

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • AIGC Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧