主题:怎样能在循环中使用输入而不影响循环进行
#include<stdio.h>
#include<time.h>
#include<graphics.h>
#include "conio.h"
int main()
{ srand(time(NULL));
int i,t,b,a,d;
char c;
float H, S, L;
MOUSEMSG m;
char s[]="欢迎玩打气球游戏",p[]="开始",k[]="退出",q[]="游戏说明",z[]="按i发射箭",w[]="射中得十分加一支箭",u[]="按任意键继续";
setinitmode(1,0,0);
initgraph(-1,-1);
setbkcolor(GREEN);
//sc_width=getwidth();
//sc_heigh=getheight();
setcolor(YELLOW);
setfont(-50,-50,"宋体");
outtextxy(200,200,s);
outtextxy(500,400,p);
outtextxy(500,600,k);
while(true)
{ m=GetMouseMsg();
if(WM_LBUTTONDOWN==m.uMsg)
{if(m.x>=500&&m.x<=700&&m.y>=350&&m.y<=450)
break;
if(m.x>=500&&m.x<=700&&m.y>=550&&m.y<=650) return 0;}
}
cleardevice();
setbkcolor(WHITE);
setbkmode(TRANSPARENT);
H = 190;
S = 1;
L = 0.7f;
for(int y = 0; y < 1640; y++)
{
L += 0.0005f;
setcolor( HSLtoRGB(H, S, L) );
line(0, y, 1640, y);
}
H = 0;
S = 1;
L = 0.5f;
setlinestyle(PS_SOLID, NULL, 2);
for(int r = 400; r > 344; r--)
{
H += 5;
setcolor( HSLtoRGB(H, S, L) );
circle(1000, 480, r);
}
setfont(-50,-40,"华文行楷");
setcolor(RED);
outtextxy(200,200,q);
delay(800);
outtextxy(200,400,z);
delay(800);
outtextxy(0,500,w);
delay(800);
outtextxy(200,600,u);
getch();
cleardevice();
setbkcolor(WHITE);
while(1)
{a=rand()%600+600;
i=840;
while(i>=0)
{
cleardevice();
line(0,i*1.2-50,50,i*1.2-50);
setcolor(BLACK);
setfillstyle(BLUE);
fillellipse(a,i,30,35);
line(a,i+35,a,i+80);
delay(1);(怎样在这个循环里加入输入语句而不影响循环进行,求大神!!!!!!!!!!!!!!)
i--;
}
}
b=10;
d=0;
while(b)
{
while(d<=1300&&d>=0)
{
cleardevice();
line(d,i*1.2-50,50+d,i*1.2-50);
setcolor(BLACK);
setfillstyle(BLUE);
fillellipse(a,i,30,35);
line(a,i+35,a,i+80);
delay(1);
i--;
d++;}
if(50+i==a&&i+35>=i*1.2-50&&i-35<=i*1.2-50)
b++;
b--;
}
closegraph();
return 0;
}
#include<time.h>
#include<graphics.h>
#include "conio.h"
int main()
{ srand(time(NULL));
int i,t,b,a,d;
char c;
float H, S, L;
MOUSEMSG m;
char s[]="欢迎玩打气球游戏",p[]="开始",k[]="退出",q[]="游戏说明",z[]="按i发射箭",w[]="射中得十分加一支箭",u[]="按任意键继续";
setinitmode(1,0,0);
initgraph(-1,-1);
setbkcolor(GREEN);
//sc_width=getwidth();
//sc_heigh=getheight();
setcolor(YELLOW);
setfont(-50,-50,"宋体");
outtextxy(200,200,s);
outtextxy(500,400,p);
outtextxy(500,600,k);
while(true)
{ m=GetMouseMsg();
if(WM_LBUTTONDOWN==m.uMsg)
{if(m.x>=500&&m.x<=700&&m.y>=350&&m.y<=450)
break;
if(m.x>=500&&m.x<=700&&m.y>=550&&m.y<=650) return 0;}
}
cleardevice();
setbkcolor(WHITE);
setbkmode(TRANSPARENT);
H = 190;
S = 1;
L = 0.7f;
for(int y = 0; y < 1640; y++)
{
L += 0.0005f;
setcolor( HSLtoRGB(H, S, L) );
line(0, y, 1640, y);
}
H = 0;
S = 1;
L = 0.5f;
setlinestyle(PS_SOLID, NULL, 2);
for(int r = 400; r > 344; r--)
{
H += 5;
setcolor( HSLtoRGB(H, S, L) );
circle(1000, 480, r);
}
setfont(-50,-40,"华文行楷");
setcolor(RED);
outtextxy(200,200,q);
delay(800);
outtextxy(200,400,z);
delay(800);
outtextxy(0,500,w);
delay(800);
outtextxy(200,600,u);
getch();
cleardevice();
setbkcolor(WHITE);
while(1)
{a=rand()%600+600;
i=840;
while(i>=0)
{
cleardevice();
line(0,i*1.2-50,50,i*1.2-50);
setcolor(BLACK);
setfillstyle(BLUE);
fillellipse(a,i,30,35);
line(a,i+35,a,i+80);
delay(1);(怎样在这个循环里加入输入语句而不影响循环进行,求大神!!!!!!!!!!!!!!)
i--;
}
}
b=10;
d=0;
while(b)
{
while(d<=1300&&d>=0)
{
cleardevice();
line(d,i*1.2-50,50+d,i*1.2-50);
setcolor(BLACK);
setfillstyle(BLUE);
fillellipse(a,i,30,35);
line(a,i+35,a,i+80);
delay(1);
i--;
d++;}
if(50+i==a&&i+35>=i*1.2-50&&i-35<=i*1.2-50)
b++;
b--;
}
closegraph();
return 0;
}