- 分享
- 0
- 人气
- 0
- 主题
- 7
- 帖子
- 4707
- UID
- 82675
- 积分
- 5108
- 阅读权限
- 22
- 注册时间
- 2007-6-18
- 最后登录
- 2021-7-27
- 在线时间
- 5767 小时
  
|
我是用code block写的c++,上网找了很多方法都试过了,目前只换到颜色,想请问下,背景色要怎么换,字体大小要怎么换,如何在里面加格子?
以下是我的coding,请高人指点指点
#include<iostream>
#include <windows.h>
using namespace std;
int main()
{
textbackgroundcolor(5);
textcolor(8+128);
clrscr();
HANDLE hConsole;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole,12);
cout << "Your text here" << endl;
return 0;
}
myself 发表于 2011-11-14 11:42 PM 
既然找到 SetConsoleTextAttribute 了就該去了解其參數用法而不是意味著能抄能行就好
- #include <iostream>
- #include <windows.h>
- using namespace std;
- int main()
- {
- HANDLE handler;
- handler = GetStdHandle( STD_OUTPUT_HANDLE );
- SetConsoleTextAttribute( handler, BACKGROUND_RED | FOREGROUND_GREEN );
- cout << "Hello world!" << endl;
- return 0;
- }
复制代码 |
|