⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menu.h

📁 水电出版社的《C语言程序设计实训》源代码
💻 H
字号:
#include <bios.h>
#include <graphics.h>
#include <math.h>
#include <alloc.h>
#include <string.h>
#include <process.h>
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>

/******************************************************
//16点阵汉字输出函数,供主函数及所有函数调用
//入口参数:   (X,Y):  输出点坐标.      Wid:  字间距.
//            Color:  字颜色.          *Str: 字符串.
//******************************************************/
void zwsc16(int x, int y, int Wid, int Color, char *Str)
{
	FILE *fp;
	unsigned Zcode, Bcode;
	int i,j,k,Rec;
	long Len;
	char Buf[32];
	fp=fopen("hzk16","rb");
	while(*Str)
	{
		if((*Str & 0x80)&&(*(Str+1)& 0x80))
		{
			Zcode = (*Str-0xa1)& 0x07f;
			Bcode = (*(Str+1)-0xa1)& 0x07f;
			Rec =Zcode * 94 + Bcode;
			Len = Rec * 32L;
			fseek(fp, Len, SEEK_SET);
			fread(Buf, 1, 32, fp);
			for(i=0; i<16; i++)
				for(j=0; j<2; j++)
				   for(k=0;k<8;k++)
					if(Buf[i*2+j]>>(7-k)&1)
						putpixel(x+j*8+k,y+i,Color);
			x = x+16+Wid;
			Str+=2;
		}
		else    Str++;
	}
	fclose(fp);
}
 Box(int x,int y,int l,int h){
setfillstyle(1,8);
bar(x,y,x+l,y+h);
setfillstyle(1,LIGHTGRAY);
bar(x+2,y+2,x+l-2,y+h-2);
setcolor(15);
line(x,y,x+l,y);
line(x,y,x,y+h);
line(x+1,y+1,x+l-1,y+1);
line(x+1,y+1,x+1,y+h-1);
}
   ReBox(int x,int y,int l,int h){
setfillstyle(1,8);
bar(x,y,x+l,y+h);
setfillstyle(1,LIGHTGRAY);
bar(x+2,y+2,x+l-2,y+h-2);
setcolor(15);
line(x,y+h,x+l,y+h);
line(x+l,y+h,x+l,y);
line(x+1,y+h-1,x+l-1,y+h-1);
line(x+l-1,y+h-1,x+l-1,y+1);
}
CoBox(int x,int y,int l,int h,int color){
setfillstyle(1,8);
bar(x,y,x+l,y+h);
setfillstyle(1,color);
bar(x+2,y+2,x+l-2,y+h-2);
setcolor(15);
line(x,y,x+l,y);
line(x,y,x,y+h);
line(x+1,y+1,x+l-1,y+1);
line(x+1,y+1,x+1,y+h-1);
}
  CoReBox(int x,int y,int l,int h,int color){
setfillstyle(1,8);
bar(x,y,x+l,y+h);
setfillstyle(1,color);
bar(x+2,y+2,x+l-2,y+h-2);
setcolor(15);
line(x,y+h,x+l,y+h);
line(x+l,y+h,x+l,y);
line(x+1,y+h-1,x+l-1,y+h-1);
line(x+l-1,y+h-1,x+l-1,y+1);
}
void getstr(int x,int y,char *str){
int key;
char ch;
char s[2];
int i=0;
s[1]='\0';
setfillstyle(SOLID_FILL,WHITE);
setcolor(DARKGRAY);
outtextxy(x+i*8,y,"_");
while((
key=getch())!=13){
if((key==8)||(key==75)){
if(i>0){
i--;
bar(x+i*8,y,x+(i+2)*8-1,y+8);
outtextxy(x+i*8,y,"_");
 }
}else if(ch=(char)(key&0x00ff)){
str[i]=ch;
s[0]=ch;
bar(x+i*8,y,x+(i+1)*8-1,y+9);
setcolor(DARKGRAY);
outtextxy(x+i*8,y,s);
outtextxy(x+(i+1)*8,y,"_");
i++;
}
else{
sound(1000);
delay(100);
nosound();
}
}
str[i]='\0';
setcolor(WHITE);
outtextxy(x+i*8,y,"_");
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -