为什么在wintc中编译成功,但是运行时却是立马就关掉了,怎么让它运行时显示出来(c语言大神求教,谢谢)
为什么在wintc中编译成功,但是运行时却是立马就关掉了,怎么让它运行时显示出来#include"stdio.h"#include"conio.h"#include"gr...
为什么在wintc中编译成功,但是运行时却是立马就关掉了,怎么让它运行时显示出来
#include "stdio.h"
#include "conio.h"
#include "graphics.h"
void fnGet_hzm(char chIncode[],char chBytes[]);
void fnDisp_hzm(int iX,int iY,int iColor,int iXscale,int iYscale,char chBuf[]);
void fnDisHz16X16(int iX,int iY,int iWidth,int iColor,int iXscale,int iYscale,char*pStr);
FILE *pFile;
char*chMain[6]={"我们是朋友",
"WOMEN SHI PENGYOU",
" 好朋友",
"地址:中国",
"Tel:26731092 Fax:0755-123456789",
" E-mail:women@qq.com"
};
void fnGet_hzm(char chIncode[],char chBytes[])
{ unsigned char chQh,chWh;
unsigned long ulOffset;
chQh=chIncode[0]-0xa0;
chWh=chIncode[1]-0xa0;
if(chQh>9)
chQh-=6;
ulOffset=(94*(chQh-1)+(chWh-1))*32L;
fseek(pFile,ulOffset,SEEK_SET);
fread(chBytes,1,32,pFile);
}
void fnDisp_hzm(int iX,int iY,int iColor,int iXscale,int iYscale,char chBuf[])
{int i,j,k,iX1,iY1;
for(i=0;i<16;i++)
for(j=0;j<2;j++)
for(k=0;k<8;k++)
if(chBuf[i*2+j]>>(7-k)&0x01)
{for(iX1=0;iX1<iXscale;iX1++)
for(iY1=0;iY1<iYscale;iY1++)
putpixel((iX+j*8+k)*iXscale+iXscale+iXscale+iX1,(iY+i)*iYscale+iY1,iColor);
}
}
void fnDisHz16X16(int iX,int iY,int iWidth,int iColor,int iXscale,int iYscale,char*pStr)
{unsigned char chBuf[35];
while(*pStr)
{if((*pStr&0x80)&&(*(pStr+1)&0x80))
{fnGet_hzm(pStr,chBuf);
fnDisp_hzm(iX,iY,iColor,iXscale,iYscale,chBuf);
iX+=(16+iWidth);
pStr+=2;
}
}
}
void main()
{
int GraphDrive ,GraphMode,i;
pFile=fopen("hzk16.dot","rb");
if(pFile==NULL)
exit();
detectgraph(&GraphDrive,&GraphMode);
initgraph(&GraphDrive,&GraphMode,"C:\\Win-TC");
setfillstyle(1,1);
bar(10,10,400,320) ;
fnDisHz16X16(20,15,4,14,2,3,chMain[0]);
setcolor(14);
outtextxy(120,100,chMain[1]);
fnDisHz16X16(240,110,4,14,1,1,chMain[2]);
fnDisHz16X16(60,80,4,14,2,2,"王小");
fnDisHz16X16(250,170,4,14,1,1,"王大");
fnDisHz16X16(50,250,4,14,1,1,chMain[3]);
outtextxy(50,290,chMain[4]);
outtextxy(50,290,chMain[5]);
fclose(pFile);
getch();
closegraph();
} 展开
#include "stdio.h"
#include "conio.h"
#include "graphics.h"
void fnGet_hzm(char chIncode[],char chBytes[]);
void fnDisp_hzm(int iX,int iY,int iColor,int iXscale,int iYscale,char chBuf[]);
void fnDisHz16X16(int iX,int iY,int iWidth,int iColor,int iXscale,int iYscale,char*pStr);
FILE *pFile;
char*chMain[6]={"我们是朋友",
"WOMEN SHI PENGYOU",
" 好朋友",
"地址:中国",
"Tel:26731092 Fax:0755-123456789",
" E-mail:women@qq.com"
};
void fnGet_hzm(char chIncode[],char chBytes[])
{ unsigned char chQh,chWh;
unsigned long ulOffset;
chQh=chIncode[0]-0xa0;
chWh=chIncode[1]-0xa0;
if(chQh>9)
chQh-=6;
ulOffset=(94*(chQh-1)+(chWh-1))*32L;
fseek(pFile,ulOffset,SEEK_SET);
fread(chBytes,1,32,pFile);
}
void fnDisp_hzm(int iX,int iY,int iColor,int iXscale,int iYscale,char chBuf[])
{int i,j,k,iX1,iY1;
for(i=0;i<16;i++)
for(j=0;j<2;j++)
for(k=0;k<8;k++)
if(chBuf[i*2+j]>>(7-k)&0x01)
{for(iX1=0;iX1<iXscale;iX1++)
for(iY1=0;iY1<iYscale;iY1++)
putpixel((iX+j*8+k)*iXscale+iXscale+iXscale+iX1,(iY+i)*iYscale+iY1,iColor);
}
}
void fnDisHz16X16(int iX,int iY,int iWidth,int iColor,int iXscale,int iYscale,char*pStr)
{unsigned char chBuf[35];
while(*pStr)
{if((*pStr&0x80)&&(*(pStr+1)&0x80))
{fnGet_hzm(pStr,chBuf);
fnDisp_hzm(iX,iY,iColor,iXscale,iYscale,chBuf);
iX+=(16+iWidth);
pStr+=2;
}
}
}
void main()
{
int GraphDrive ,GraphMode,i;
pFile=fopen("hzk16.dot","rb");
if(pFile==NULL)
exit();
detectgraph(&GraphDrive,&GraphMode);
initgraph(&GraphDrive,&GraphMode,"C:\\Win-TC");
setfillstyle(1,1);
bar(10,10,400,320) ;
fnDisHz16X16(20,15,4,14,2,3,chMain[0]);
setcolor(14);
outtextxy(120,100,chMain[1]);
fnDisHz16X16(240,110,4,14,1,1,chMain[2]);
fnDisHz16X16(60,80,4,14,2,2,"王小");
fnDisHz16X16(250,170,4,14,1,1,"王大");
fnDisHz16X16(50,250,4,14,1,1,chMain[3]);
outtextxy(50,290,chMain[4]);
outtextxy(50,290,chMain[5]);
fclose(pFile);
getch();
closegraph();
} 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励20(财富值+成长值)
若以下回答无法解决问题,邀请你更新回答
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询