using namespace std
int main()
{
cout<<或轿逗"现在正在下雨吗?"<<endl
char c='a'
cin>>c
while(1)
{
switch(c)
{
case 'Y': cout<<"现在正衫卖在下雨"<<endlbreak
case '帆指N': cout<<"现在没有下雨"<<endlbreak
default:cout<<"现在正在下雨吗?"<<endl
}
cin>>c
}
return 0
}
初始察仿化肢则void Init_Data()
{
int i
for( i=0i<POINTi++)
{
Snow[i].x=0
Snow[i].y=0
Snow[i].size=0
}
for( i=0i<MaxXi++)
Map[i]=MaxY
}
显示:
void MakeSnow()
{
int i
if( CurSnow>=POINT ) return
for( i=0Snow[i].sizei++ )
CurSnow++
Snow[i].x=random(MaxX)
Snow[i].y=random(DOWNSPEED)
Snow[i].size=random(MaxSize)+1
}
设定显示坐标
void ShowSnow( int x, int y, int size, int flag )
{
int color=0
if ( flag ) color=15
switch( size )
{
case 1:
putpixel( x, y, color )
break
case 2:
setcolor( color )
line( x-1, y-1, x+1, y+1 )
line( x-1, y+1, x+1, y-1 )
break
case 3:
setcolor( color )
line( x-1, y-1, x+1, y+1 )
line( x-1, y+1, x+1, y-1 )
/*
line( x-2, y-2, x+2, y+2 )
line( x-2, y+2, x+2, y-2 )*/
line( x-2, y, x+2, y )
line( x, y-2, x, y+2 )
break
}
}
雪花移动效果:
void Move( int n, int tox, int toy )
{
int x, y, size, i, j
float person
x=Snow[n].x
y=Snow[n].y
size=Snow[n].size
/* check end */
j=y
if( x<tox )
{
person=(DOWNSPEED *1.0) / ( tox-x )*1.0
for( i=xi<=toxi++ )
{
if( j>=Map[i] )
{
tox=i-size
break
}
j+=(int)( (i-x+1)*person )
}
}
else if( x>tox )
{
person=(DOWNSPEED *1.0) / ( x-tox )*1.0
for( i=xi>=toxi-- )
{
if( j>=Map[i] )
{
tox=i+size
break
}
j+=(int)( (x-i+1)*person )
}
}
if( y+DOWNSPEED>历没棚=Map[tox] )
{
switch( size )
{
case 1:
Map[x]--
break
case 2:
Map[x]-=2
if( x>0 &&Map[x-1]>Map[x] ) Map[x-1]=Map[x]
if( x<MaxX-1 &&Map[x+1]>Map[x] ) Map[x+1]=Map[x]
break
case 3:
Map[x]-=3
if( x>1 &&Map[x-2]>Map[x] ) Map[x-1]=Map[x]
if( x>0 &&Map[x-1]>Map[x] ) Map[x-1]=Map[x]
if( x<MaxX-2 &&Map[x+2]>Map[x] ) Map[x+1]=Map[x]
if( x<MaxX-1 &&Map[x+1]>Map[x] ) Map[x+1]=Map[x]
break
}
CurSnow--
y=Map[x]+size
Snow[n].x=x
Snow[n].y=y
Snow[n].size=0
}
else /* not end */
{
Snow[n].x=tox
Snow[n].y=toy
}
}
#include<iostream>using namespace std
void main()
{char a
cout<<"现在在下雨吗?"
cout<<"请带谈输入Y/N"
cin>>a
if(a=='Y') cout<<"正在下雨"
else if (a=='N') cout<<"现在没有下雨"
else cout<<"现在正在下雨吗?"
}
//樱行首随便编了下 应该可以脊数吧 注意下大小写
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)