?? 73.c
字號:
#include<stdio.h>
#include<stdlib.h>
#include<graphics.h>
#include<conio.h>
#include<dos.h>
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(LIGHTGRAY);
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(LIGHTGRAY);
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,"_");
}
main()
{
int gd=DETECT,gm;
char *str1;
initgraph(&gd,&gm," ");
setbkcolor(1);
getstr(100,100,str1);
getch();
closegraph();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -