再dev c++里面如何实现tc的graphics.h的功能!?

lonelybug 2003-03-10 11:28:53
告诉我一下!谢了!
...全文
555 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
lonelybug 2003-03-11
  • 打赏
  • 举报
回复
那再请教一下!我说的那个.H的文件里面不能定义function是这样吗!?还有function也不能定义为struct里面的一个成员!?
请高手指点一下!
下面是我的程序.cpp的和.H的!

。。。。。。。。main.cpp。。。。。。。。。。
#include "..\Module.h"
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <graphics.h>


trade_info T_info;//define the T_info as Trade_info
void Config();

void main(){
Config();
};

void Config()
{
T_info.initialize();
T_info.Litre_Price=3.1;
T_info.Machine_Num=1;
};

void Main_Screen()
{
Gas_Type_Screen();
}

。。。。。。。。module.h。。。。。。。。。。

#ifndef Module_H_
#define Module_H_

struct trade_info
{
float Litre_Price; /*every one litre gas' price.*/
int Machine_Num;/*gas station machine number.*/
int Gas_Number; /*define gas type.*/
float Trade_Cost;/*the amount of cost.*/
float Trade_quantity;/*the amount of quantity. */
char Payment_Type[19];/*which ways to payment such as Visa, IC, Cash.*/
char Card_Id[19];/*Visa Card or IC Card.*/
char Card_Password[5];
void initialize();
};
int Gas_Type_Screen();
#endif

。。。。。。。。module.cpp。。。。。。。。。。

#include "..\module.h"
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <graphics.h>

void trade_info::initialize(trade_info p_stuct)
{
p_stuct.Litre_Price=0; /*every one litre gas' price.*/
p_stuct.Machine_Num=0;/*gas station machine number.*/
p_stuct.Gas_Number=0; /*define gas type.*/
p_stuct.Trade_Cost=0;/*the amount of cost.*/
p_stuct.Trade_quantity=0;/*the amount of quantity. */
};


int Gas_Type_Screen()
{
int gasnum=0;
clrscr();
gotoxy(24,20);
printf("PLEASE INPUT GAS TYPE NUMBER(ex:97)");
gotoxy(24,21);
scanf("%i",&gasnum);
gotoxy(24,22);
printf("%i",gasnum);
return gasnum;
}

注:我用的是C语言谢的,所以可能很多地方不能实现面向对象的方法!请各位打下对有关此问题高抬贵手,不要加以追究!
cxjddd 2003-03-10
  • 打赏
  • 举报
回复
如果会Win32API的话,就用<windows.h>吧(我想楼主是不会的吧).
另外,就用强大的工具了,如VC,BCB.
chinajiji(菜鸟叽叽)说的包,可以一试.
chinajiji 2003-03-10
  • 打赏
  • 举报
回复
难!我帮你试过,没成功.TC的graphics.lib格式DEV-CPP不认.
你可以下面的package来处理creating graphical user interfaces
http://www.bloodshed.net/dev/packages/gtk.html
csr1103 2003-03-10
  • 打赏
  • 举报
回复
TC3里面你所说的问题在我的机子上没有。
graphics.h是TC系列的图形库处理函数。不是标准库内容。
DEV C++里面没有这个库。
自己做的话,呵呵。我不知道做。
还得学很多。UP一下。
lonelybug 2003-03-10
  • 打赏
  • 举报
回复
是不是TC30里面不能在.H文件中来声明一个function呢!?而且也不能把function放到struct里面呢!?我试乐一下,好像只能在.H文件中声明struct!请问是否如此!!?
如果我要用Dev C++来开发,如何实现TC里面graphics.h的效果!谢谢乐!

69,382

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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