Skip to content

HideakiAtsuyo/cpp-things

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

cpp-things

BG & FG colors

void color(int fg, int bg)
{
    HANDLE H = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(H, bg * 16 + fg);
}

Default colors: color(15, 0);

Colors:

0: Black/Noir
1: Dark Blue/Bleu Foncé
2: Green/Vert
3: Blue-Grey/Bleu-Gris
4: Marron
5: Purple/Violet
6: kaki
7: Light Grey/Gris Clair
8: Grey/Gris
9: Blue/Bleu
10: Neon Green/Vert Fluo
11: Turquoise
12: Red/Rouge
13: Neon Pink/Rose Fluo
14: Neon Yellow/Jaune Fluo
15: White/Blanc

=================================================================

Put Ascii

http://patorjk.com/software/taag/#p=display&f=Big%20Money-nw&t=Ascii

std::cout << R"(
 $$$$$$\                      $$\ $$\ 
$$  __$$\                     \__|\__|
$$ /  $$ | $$$$$$$\  $$$$$$$\ $$\ $$\ 
$$$$$$$$ |$$  _____|$$  _____|$$ |$$ |
$$  __$$ |\$$$$$$\  $$ /      $$ |$$ |
$$ |  $$ | \____$$\ $$ |      $$ |$$ |
$$ |  $$ |$$$$$$$  |\$$$$$$$\ $$ |$$ |
\__|  \__|\_______/  \_______|\__|\__|
)" << std::endl;

=================================================================

Fuck Curl => CPR ("Curl Wrapper") is better

CPR


=================================================================

See your exe name

#include <iostream>
#include <boost/dll.hpp> //Debug&Release => Only x86
#include <windows.h>

void main() {
    SetConsoleOutputCP(CP_UTF8);
    std::string name = boost::dll::program_location().filename().string();
	std::cout << name << std::endl;
    system("pause");
}

=================================================================

Check the content of a string

std::string a = "Dick Head";
if (a.find("Head") != std::string::npos) {
std::cout << "Found" << std::endl;
} else {
std::cout << "Not Found" << std::endl;
}

=================================================================

Get Screen Size

#include <iostream>
#include <Windows.h>

int main()
{
    std::cout << "Hello World!\n" << GetSystemMetrics(SM_CXSCREEN) << "x" << GetSystemMetrics(SM_CYSCREEN) << std::endl;
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages