标签:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include
<iostream>#include
<Windows.h>#include
<stdio.h>#include
<stdarg.h>using
namespace
std;void
cprintf(char*
str, WORD
color, ...);int
main() { cprintf("H",
10); cprintf("e",
9); cprintf("l",
12); cprintf("l",
11); cprintf("o",
13); cprintf("
",
10); cprintf("W",
15); cprintf("o",
2); cprintf("r",
5); cprintf("l",
8); cprintf("d",
14); cprintf("!",
4); return
0;}void
cprintf(char*
str, WORD
color, ...) { WORD
colorOld; HANDLE
handle = ::GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_SCREEN_BUFFER_INFO
csbi; GetConsoleScreenBufferInfo(handle,
&csbi); colorOld
= csbi.wAttributes; SetConsoleTextAttribute(handle,
color); cout
<< str; SetConsoleTextAttribute(handle,
colorOld);} |
标签:
原文地址:http://blog.csdn.net/u012374012/article/details/44222503