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

热点内容
ps3运行镜像文件 浏览:970
切纸刀哪个是编程键 浏览:155
现在网络游戏都要什么证件 浏览:357
福特全顺更换车身控制模块如何编程 浏览:815
华为公司用什么编程软件 浏览:758
vi文件内容复制 浏览:548
国民经济数据在哪里查看 浏览:132
一键复制所有文件名至excel 浏览:127
表格中如何设置单元格数据格式 浏览:936
cnc编程和plc编程哪个好学 浏览:148
Steam文件如何更改路径 浏览:738
手机如何设置app变得像果冻 浏览:636
竖版word模板 浏览:813
pdf格式文件超大怎么发微信 浏览:710
一通网络电话怎么使用 浏览:396
如何能让苹果变粉 浏览:175
ipad连接wifi怎么看到密码 浏览:233
神经网络试题 浏览:136
青鸟消防主机联动声光怎么编程 浏览:707
70nrd90m是那个版本 浏览:253

友情链接