8 font Time Display letters, additional console color settings

Source: Internet
Author: User
Tags cursorinfo

#include <windows.h>
#include <iostream>
#include "time.h"
#include "conio.h"
using namespace Std;
const int len=5,wid=7;//Each word is len*wid (length and height), wid must be an odd number


HANDLE Houtput=getstdhandle (Std_output_handle);//console output handle
Console_cursor_info Cursorinfo = {TRUE, FALSE};


void Gotoxy (int x,int y)
{
COORD Loc={x,y};
SetConsoleCursorPosition (Houtput,loc);
}
/*
The first number represents the background color, and the second number represents the foreground. The code for each color is as follows:
0= Black 1= Blue 2 = Green 3= Lake Blue 4 = Red 5 = Purple 6 = Yellow 7 = White Gray 8 = Gray
9= bright blue a= bright green b= bright blue green c= bright red d= bright purple red e= bright yellow f= bright white
*/

void Showpoint (int);//length of 2 spaces long
void ShowSpace (int);

void Show (Char[],int,int);

void Randcolor (int);
void Display (Char,int,int);


int main ()
{
System ("Color F0");
Setconsoletitlea ("chenjing");//Window name
Setconsolecursorinfo (Houtput, &cursorinfo); Set cursor Hide

Char ch[]= "Thank you and I love your but don't Love Me";
for (int i=0;i<strlen (CH); i++)
{
Display (ch[i],8* (i%10), 6* (I/10));
}
System ("pause");

/*
SYSTEMTIME SYS;

int h,m,s;
int h1,h2,m1,m2,s1,s2;

Getlocaltime (&sys);
H=sys.whour;
M=sys.wminute;
S=sys.wsecond;
h1=h/10,h2=h%10,m1=m/10,m2=m%10,s1=s/10,s2=s%10;

Show (h1,0,0); Show (h2,2*len+1,0);
Gotoxy (4*len+2, (wid-1)/2);
Showpoint (1);
Gotoxy (4*len+2,wid-1);
Showpoint (1);
Show (m1,4*len+5,0); Show (m2,6*len+6,0);
Show (s1,35,0); Show (s2,52,0);
*/


CloseHandle (Houtput);
return 0;
}


void Showpoint (int n)//length of 2 spaces long
{
for (int i=0;i<n;i++)
{
Randcolor (rand ()%9);
cout<< "";
}
}
void ShowSpace (int n)
{
for (int i=0;i<n;i++)
cout<< "";
}

void Show (char array[],int x,int y)
{
int i,j;
for (i=0;i<5;i++)
{
for (j=0;j<3;j++)
{
Gotoxy (X+2*j,y);
if (array[3*i+j]-' 0 ') showpoint (1);
else ShowSpace (1);
}
y++;
}
}

/*
The first number represents the background color, and the second number represents the foreground. The code for each color is as follows:
0= Black 1= Blue 2 = Green 3= Lake Blue 4 = Red 5 = Purple 6 = Yellow 7 = White Gray 8 = Gray
9= bright blue a= bright green b= bright blue green c= bright red d= bright purple red e= bright yellow f= bright white
*/
void Randcolor (int n)
{
Switch (n)
{
Default:break;
Case 0:setconsoletextattribute (Houtput, 0xf9);
Case 1:setconsoletextattribute (Houtput, 0xFA);
Case 2:setconsoletextattribute (Houtput, 0xFB);
Case 3:setconsoletextattribute (Houtput, 0xFC);
Case 4:setconsoletextattribute (Houtput, 0xFD);
Case 5:setconsoletextattribute (Houtput, 0xFE);
Case 6:setconsoletextattribute (Houtput, 0xF0);
Case 7:setconsoletextattribute (Houtput, 0xf3);
Case 8:setconsoletextattribute (Houtput, 0xF8);
}
}

void Display (char ch,int x,int y)
{
Switch (CH)
{
Default:break;
Case ' A ': Case ' a ': Show ("111001111101111", X, y); break;
Case ' B ': case ' B ': Show ("100100111101111", X, y); break;
Case ' C ': Case ' C ': Show ("000000111100111", X, y); break;
Case ' d ': Case ' d ': Show ("001001111101111", X, y); break;
Case ' E ': Case ' E ': Show ("111101111100111", X, y); break;
Case ' F ': Case ' F ': Show ("111100110100100", X, y); break;
Case ' G ': Case ' G ': Show ("111101111001111", X, y); break;
Case ' h ': Case ' h ': Show ("101101111101101", X, y); break;
Case ' I ': Case ' I ': Show ("100000100100100", X, y); break;
Case ' J ': Case ' J ': Show ("001000001001011", X, y); break;
Case ' K ': Case ' K ': Show ("100100111100100", X, y); break;
Case ' l ': Case ' l ': Show ("100100100100110", X, y); break;
Case ' m ': Case ' m ': Show ("111001111001111", X, y); break;
Case ' n ': Case ' n ': Show ("000000111101101", X, y); break;
Case ' O ': Case ' o ': Show ("000000111101111", X, y); break;
Case ' P ': Case ' P ': Show ("111101111100100", X, y); break;
Case ' Q ': Case ' Q ': Show ("111101111001001", X, y); break;
Case ' R ': Case ' R ': Show ("101101111100100", X, y); break;
Case ' s ': Case's ': Show ("111100111001111", X, y); break;
Case ' t ': Case ' t ': Show ("100100111100111", X, y); break;
Case ' u ': Case ' U ': Show ("000000101101111", X, y); break;
Case ' V ': Case ' V ': Show ("000101101101111", X, y); break;
Case ' W ': Case ' W ': Show ("001001111001001", X, y); break;
Case ' x ': Case ' x ': Show ("111100111001001", X, y); break;
Case ' y ': Case ' y ': Show ("101101111001111", X, y); break;
Case ' Z ': Case ' Z ': Show ("111001111100111", X, y); break;
Case ': Show ("000000000000000", X, y);
}
}

8 font Time Display letters, additional console color settings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.