33,317
社区成员
发帖
与我相关
我的任务
分享#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<windows.h>
void HideCursor(int x)
{
CONSOLE_CURSOR_INFO cursor_info = { 1, x };
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}
void SetColor(int color)
{
HANDLE consolewnd;
consolewnd = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(consolewnd, color);
}
void GotoXY(int x,int y)//-------左括号和逗号是汉语格式,应改为英文格式--------
{
COORD pos;
pos.X = x - 1;
pos.Y = y - 1;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
void DrawPlan(int x, int y)
{
GotoXY(x, y);//------------修改--------------
printf("▲");
GotoXY(x, y + 1);
printf("■");
GotoXY(x, y + 2);
printf("◢■◣");
GotoXY(x, y + 3);
printf("◢■◣");
GotoXY(x, y + 4);
printf("◢■■■◣");
GotoXY(x, y + 5);
printf("◢■■■■■◣");
GotoXY(x, y + 6);
printf("◢■◣");
GotoXY(x, y + 7);
printf("◢■■■◣");
}
int main()
{
system("mode con cols=75 lines=22");
HideCursor(0);
SetColor(15);//-------左括号和分号是汉语格式,应改为英文格式--------
DrawPlan(10, 12);
DrawPlan(30, 5);
DrawPlan(50, 12);
getchar();
HideCursor(1);
return 0;
}
