怎么制作代碼雨 如何實現(xiàn)c語言程序各顏色數(shù)字雨代碼?
如何實現(xiàn)c語言程序各顏色數(shù)字雨代碼?#includeltstdio.hgt#includelttime.hgt#includeltwindows.hgttypedefstruct{int x,ycha
如何實現(xiàn)c語言程序各顏色數(shù)字雨代碼?
#includeltstdio.hgt
#includelttime.hgt
#includeltwindows.hgt
typedefstruct
{
int x,y
charch
}STU
STUst[100]
//出現(xiàn)位置
voidgotoxy(int x,int y)
{
HANDLEhout
COORDpos
pos.Xx
pos.Yy
houtGetStdHandle(STD_OUTPUT_HANDLE)
SetConsoleCursorPosition(hout,pos)
}
/*隱藏光標(biāo)*/
typedefshow_cursor(inthide)
{
CONSOLE_CURSOR_INFOcciCursor
HANDLEhout
houtGetStdHandle(STD_OUTPUT_HANDLE)
if(GetConsoleCursorInfo(hout,ampcciCursor))
{
hide
SetConsoleCursorInfo(hout,ampcciCursor)
}
}
/*設(shè)置顏色*/
structset_color(int color)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),color)
}
assign()
{
int i,j
show_cursor(0)
srand(time(false))
//初始化結(jié)構(gòu)體
for(hvt)
{
st[i].xrand()
st[i].yrand()
st[i].chrand()%(49-47)48
}
while(1)
{
for(hssl)
{
gotoxy(st[i].x,st[i].y)
set_color(0x2)//最先出現(xiàn)的顏色;
putchar(st[i].ch)
gotoxy(st[i].x,st[i].y-5)
putchar()
st[i].y
st[i].chrand()%(49-47)48
if(st[i].y-5gt18)
{
gotoxy(st[i].x,st[i].y-1)
putchar()
gotoxy(st[i].x,st[i].y-2)
putchar()
gotoxy(st[i].x,st[i].y-3)
putchar()
gotoxy(st[i].x,st[i].y-4)
putchar()
gotoxy(st[i].x,st[i].y-4)
putchar()
}
if(st[i].ya823)
{
st[i].xrand()
st[i].yrand()
}
gotoxy(st[i].x,st[i].y)
set_color(0xA)//由前一個顏色漸變成的顏色
putchar(st[i].ch)
}
Sleep(120)
}
}
color(0)printf(
10個雨字圍一圈中間5個風(fēng)字猜成語?
答案是五風(fēng)十雨。
【成語】:五風(fēng)十雨
【拼音】:wǔfēngshíyǔ
【講解】:五天刮兩次風(fēng),十天下一場雨。形容年年豐收。
【出處】:漢·王充《論衡·是應(yīng)》:“風(fēng)不鳴條,雨不破塊,五日一風(fēng),十日一雨?!?/p>
【舉例說明排比句】:五風(fēng)十雨天時好,又見西郊稻秫肥。宋·王炎《雙溪詩鈔·豐年謠(一)》
【拼音代碼】:wfsy
【近義詞】:人畜興旺
【用法】:作補(bǔ)語、定語;指風(fēng)調(diào)雨順五谷豐登