導航:首頁 > 編程知識 > gotoxy是哪個編程語言

gotoxy是哪個編程語言

發布時間:2025-01-23 06:29:47

A. C語言中有沒有能返回上一行的控制符

用gotoxy函數可以讓游標去任何位置!
wherex()和wherey()兩個函數可以返回當前游標位置。
所在頭文件:conio.h
函數原型:void gotoxy(int x,int y)
int wherex(void)
int wherey(void)
輸入參數:x,y 為要移動的目的坐標位置
如:返回上一行開頭:gotoxy(1,wherey()-1);

B. 如何實現c語言程序各顏色數字雨代碼

#include<stdio.h>

#include<time.h>

#include<windows.h>

typedef struct

{

int x,y;

char ch;

}STU;

STU st[100];

//出現位置

void gotoxy(int x, int y)

{

HANDLE hout;

COORD pos;

pos.X = x;

pos.Y = y;

hout = GetStdHandle(STD_OUTPUT_HANDLE);

SetConsoleCursorPosition(hout, pos);

}

/*隱藏游標*/

void show_cursor(int hide)

{

CONSOLE_CURSOR_INFO cciCursor;

HANDLE hout;

hout = GetStdHandle(STD_OUTPUT_HANDLE);

if(GetConsoleCursorInfo(hout, &cciCursor))

{

cciCursor.bVisible = hide;

SetConsoleCursorInfo(hout, &cciCursor);

}

}

/*設置顏色*/

void set_color(int color)

{

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);

}

main()

{

int i,j;

show_cursor(0);

srand(time(NULL));

//初始化結構體

for (i=0;i<100;i++)

{

st[i].x = rand()%80;

st[i].y = rand()%20;

st[i].ch = rand()%(49-47)+48;

}

while (1)

{

for (i=0;i<100;i++)

{

gotoxy(st[i].x,st[i].y);

set_color(0x2);//最先出現的顏色;

putchar(st[i].ch);

gotoxy(st[i].x,st[i].y-5);

putchar(' ');

st[i].y++;

st[i].ch = rand()%(49-47)+48;

if (st[i].y-5>=18)

{

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].y > 23)

{

st[i].x = rand()%80;

st[i].y = rand()%20;

}

gotoxy(st[i].x,st[i].y);

set_color(0xA);//由前一個顏色漸變成的顏色

putchar(st[i].ch);

}

Sleep(120);

}

}

color(0);printf("黑色 ");color(1);printf("藍色 ");color(2);printf("綠色 ");color(3);printf("湖藍色 ");color(4);printf("紅色 ");color(5);printf("紫色 ");color(6);printf("黃色 ");color(7);printf("白色 ");color(8);printf("灰色 ");color(9);printf("淡藍色 ");color(10);printf("淡綠色 ");color(11);printf("淡淺綠色 ");color(12);printf("淡紅色 ");color(13);printf("淡紫色 ");color(14);printf("淡黃色 ");color(15);printf("亮白色 ")

幾個基本的顏色;

閱讀全文

與gotoxy是哪個編程語言相關的資料

熱點內容
微信怎麼發超過30分鍾的視頻文件 瀏覽:266
手機怎麼下載探月編程 瀏覽:647
手機怎麼取消屏保密碼怎麼設置 瀏覽:1
風行視頻2014舊版本 瀏覽:758
linux腳本傳輸文本到文件 瀏覽:96
怎麼刪除ipad的qq的文件 瀏覽:20
編程如何解釋事件 瀏覽:678
1855鏡頭升級版 瀏覽:454
哪些網站可以找到卷子 瀏覽:701
asp資料庫密碼 瀏覽:829
如何非同步提交post數據 瀏覽:552
分區後文件去哪裡了 瀏覽:806
電腦關機會清空數據怎麼設置 瀏覽:472
cad注冊文件刪 瀏覽:7
蘋果pro筆記本中配 瀏覽:860
西安招工網站有哪些 瀏覽:120
惠州找客戶app哪裡的好 瀏覽:597
凱立德導航卡文件都有哪些 瀏覽:609
怎麼將pdf文件上傳到慕課 瀏覽:768
cad怎麼做文件標簽 瀏覽:235

友情鏈接