导航:首页 > 编程知识 > 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是哪个编程语言相关的资料

热点内容
华为手机如何拦截不良网站 浏览:407
联通4g用什么系统版本 浏览:807
iphone5s尺寸图纸下载 浏览:780
笔记本ghost以后不能安装系统文件丢失 浏览:659
aspnet网站源码vb 浏览:427
编程软件怎么下载到电脑里 浏览:353
win10网页乱码不是中文 浏览:192
iphone信息发送栏是灰色的 浏览:576
用什么软件打开sid文件 浏览:511
怎么在网站中下视频 浏览:485
文件夹套打 浏览:192
网络老菩萨什么意思 浏览:845
苹果复杂密码字母怎么输入 浏览:532
iis7应用程序池回收设置 浏览:420
javadoc文件夹 浏览:876
大数据是哪个年代出现的 浏览:701
app版权信息格式 浏览:505
matlab程序运行截图 浏览:771
ideajava转maven 浏览:229
气象博士app为什么用不了了 浏览:742

友情链接