本文代码使用较为简单,主要就是为了高亮打印,直接用即可
代码如下:
/**
* @file cout.h
* @author BigDavid
* @brief
* @version 0.1
* @date 2024-07-10
*
* @copyright Copyright (c) 2024
*
*/
#pragma once
#include<stdio.h>
#include<unistd.h>
#define SHAN "\033[5;30;41m"
#define RED "\033[0;30;41m"
#define GREEN "\033[0;30;42m"
#define YELLOW "\033[0;30;43m"
#define BULE1 "\033[0;30;44m"
#define PURPLE "\033[0;30;45m"
#define BULE2 "\033[0;30;46m"
#define WHITE "\033[0;30;47m"
#define ENDL "\033[0m\n"
测试:
#include "cout.h"
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
cout << SHAN << "BigDavid" << ENDL;
cout << WHITE << "BigDavid" << ENDL;
cout << RED << "BigDavid" << ENDL;
cout << YELLOW << "BigDavid" << ENDL;
cout << BULE1 << "BigDavid" << ENDL;
cout << PURPLE << "BigDavid" << ENDL;
cout << BULE2 << "BigDavid" << ENDL;
return 0;
}
效果:
最上面那个是高亮