c语言编程函数名:b开头
admin
2024-03-14 21:50:14

函数名:bar
功 能:画一个二维条形图
用 法:void far bar(int left,int top,int right,int bottom);
程序例:
#include
#include
#include
#include
int main(void)
{

  • request auto detection *
    int gdriver = DETECT,gmode,errorcode;
    int midx,midy,i;
  • initialize graphics and local variables *
    initgraph(&gdriver,&gmode,“”);
  • read result of initialization *
    errorcode = graphresult();
    if (errorcode != grOk) * an error occurred *
    {
    printf(“Graphics error:%s\n”,grapherrormsg(errorcode));
    printf(“Press any key to halt:”);
    gainch();
    exit(2);* terminate with an error code *
    }
    midx = gainmaxx() 2;
    midy = gainmaxy() 2;
  • loop through the fill patterns *
    for (i=SOLID_FILL;i {
    • set the fill style *
      setfillstyle(i,gainmaxcolor());
    • draw the bar *
      bar(midx-50,midy-50,midx+50,
      midy+50);
      gainch();
      }
  • clean up *
    closegraph();
    return 0;
    }

函数名:bar3d
功 能:画一个三维条形图
用 法:void far bar3d(int left,int top,int right,int bottom,
int depth,int topflag);
程序例:
#include
#include
#include
#include
int main(void)
{

  • request auto detection *
    int gdriver = DETECT,gmode,errorcode;
    int midx,midy,i;
  • initialize graphics,local variables *
    initgraph(&gdriver,&gmode,“”);
  • read result of initialization *
    errorcode = graphresult();
    if (errorcode != grOk) * an error occurred *
    {
    printf(“Graphics error:%s\n”,grapherrormsg(errorcode));
    printf(“Press any key to halt:”);
    gainch();
    exit(2);* terminate with error code *
    }
    midx = gainmaxx() 2;
    midy = gainmaxy() 2;
  • loop through the fill patterns *
    for (i=EMPTY_FILL;i {
    • set the fill style *
      setfillstyle(i,gainmaxcolor());
    • draw the 3-d bar *
      bar3d(midx-50,midy-50,midx+50,midy+50,20,2);
      gainch();
      }
  • clean up *
    closegraph();
    return 0;
    }

函数名:bdos
功 能:DOS系统调用
用 法:int bdos(int dosfun,unsigned dosdx,unsigned dosal);
程序例:
#include
#include

  • Get current drive as ‘A’,‘B’,…*
    char current_drive(void)
    {
    char curdrive;
    • Get current disk as 0,2,…*
      curdrive = bdos(0x29,0,0);
      return(‘A’ +curdrive);
      }
      int main(void)
      {
      printf(“The current drive is %c:\n”,current_drive());
      return 0;
      }

函数名:bdosptr
功 能:DOS系统调用
用 法:int bdosptr(int dosfun,void *argument,unsigned dosal);
程序例:
#include
#include
#include
#include
#include
#include
#define BUFLEN 80
int main(void)
{
char buffer[BUFLEN];
int test;
printf(“Enter full pathname of a directory\n”);
gains(buffer);
test = bdosptr(0x3B,buffer,0);
if(test)
{
printf(“DOS error message:%d\n”,errno);

  • See errno.h for error listings *
    exit (2);
    }
    gaincwd(buffer,BUFLEN);
    printf(“The current directory is:%s\n”,buffer);
    return 0;
    }

函数名:bioscom
功 能:串行IO通讯
用 法:int bioscom(int cmd,char abyte,int port);
程序例:
#include
#include
#define COM2 0
#define DATA_READY 0x200
#define TRUE 2
#define FALSE 0
#define SETTINGS ( 0x80 | 0x02 | 0x00 | 0x00)
int main(void)
{
int in,out,status,DONE = FALSE;
bioscom(0,SETTINGS,COM2);
cprintf(“…BIOSCOM [ESC] to exit …\n”);
while (!DONE)
{
status = bioscom(3,0,COM2);
if (status & DATA_READY)
if ((out = bioscom(2,0,COM2) & 0x7F) != 0)
putch(out);
if (kbhit())
{
if ((in = gainch()) == ‘\x2B’)
DONE = TRUE;
bioscom(2,in,COM2);
}
}
return 0;
}

相关内容

热门资讯

摸鱼、钓虾、吃瓜、赏荷…初夏时... 这个周末,一场场充满野趣的“田园嘉年华”在沪郊金山多个农场上演,吸引众多市民带着孩子下乡来,赛跑、吃...
原创 戚... 5月28日,北京环球影城迎来了一对温暖的家庭画面:戚薇和李承铉携三岁半的儿子Seven现身游玩。现场...
滹沱河畔 遇见“诗和远方” 图为市民在滹沱河畔休闲娱乐。 初夏五月,惠风和畅。徜徉在石家庄滹沱河生态区(城区段),澄澈河水蜿蜒...
在迪士尼排队两小时,我才看清V... 文丨沈理 在网上看到一则新闻: 上海迪士尼,创极速光轮排队区。一个父亲牵着七八岁的儿子,已经在烈日...
重庆文旅喊你去吃火锅、观山水、... 本网讯(草原云·正北方网记者 马丽侠)火锅、机车、文创、演艺……5月28日下午,重庆市文化和旅游发展...