在学习c++的路上,我注册了一个CSDN账号(为了方便),在CSDN中我学会了很多......
提示:在创作的过程中都有哪些收获
例如:
你过去写得最好的一段代码是什么?
- #ifndef PRGB_HPP
- #define PRGB_HPP
-
- #ifndef PB_HPP
- #define PB_HPP
-
- /*头文件*/
- #include
- #include
- #include
- #include
-
- /*PD库*/
- #define PDAPI
- namespace PD{
- class{
- public:
- void what(){
- printf("作者:杨某一辰\n介绍:CSDN博客,主页:https://blog.csdn.net/langhat\n");
- printf("库名:PD\n开始编写时间:2023-9-23\n版本:1.0.0(非正式)\n版本开始编写时间:2023-9-23\n");
- }
- }pdl;
- }
-
- /*类型*/
- typedef bool PBool;
- #define PStr std::string
-
- /*API和类*/
- namespace PD{}
-
- #endif
- #include
- #include
-
- //s:淡 b:亮
- #define BLACK 0
- #define BLUE 1
- #define GREEN 2
- #define SBULE 3
- #define RED 4
- #define PURPLE 5
- #define YELLO 6
- #define WHILE 7
- #define ASH 8
- #define S_EBULE 9
- #define BGREEN 10
- #define BBULE 11
- #define SRED 12
- #define SPURPLE 13
- #define BYELLO 14
- #define BWHILE 15
-
- //SetRGB
- //COLOR Max&Min value
- #define MAXCOLOR 256
- #define MINCOLOR 0
-
- //Neutral color
- #define RGB_WHITE 255,255,255
- #define RGB_BLACK 0,0,0
- #define RGB_GREY 190,190,190
- #define RGB_LGREY 211,211,211
-
- //Color:
- #define RGB_RED 256,0,0
- #define RGB_YELLOW 255,255,0
- #define RGB_BULE 0,0,256
- #define RGB_GREEN 0,256,0
- //More yellow:
- #define RGB_YELLOW2 238,238,0
- #define RGB_YELLOW3 205,205,0
- #define RGB_YELLOW4 139,139,0
- //;
- //;
-
- #define GetRGBColorHelp() system("start https:\\tool.oschina.net\commons?type=3")
-
- namespace PD{
-
- int SetRGB(int r,int g,int b){
- HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
- if(hOut==INVALID_HANDLE_VALUE)return GetLastError();
- DWORD dwMode=0;
- if(!GetConsoleMode(hOut,&dwMode))return GetLastError();
- dwMode|=0x0004;
- if(!SetConsoleMode(hOut,dwMode))return GetLastError();
- wprintf(L"\x1b[38;2;%d;%d;%dm",r,g,b);
- return 0;
- }
-
- void SetColor(int fore,int back){
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),(back<<4)+fore);
- }
-
- }
-
- #endif
注:这是我写的一个库的其中的两个文件(Pb.hpp,PRGB.hpp)
用了一些windowsAPI,SetRGB() 是设置颜色(RGB)
学会Qt,MFC,Windows程序,但看来还要很久......