+ 1

how to color the text

#include<iostream> //ardho ainullah 😊😊😊😊😊😊😊 using namespace std; int main() { string user, pass; cout << "==========login=========="; cout << "\n= Welcome My Home ="; cout << "\n= No Team No Friend ="; cout << "\n=========admin==========="; cout << "\nUsername :"; cin >> user; cout << "\nPassword :"; cin >> pass; if (user == "Muhakemos" && pass == "sabyanku") { cout << "login sukses!" << endl; } else { cout << " login failed! username or password is wrong" << endl; } cin >> pass; cout << "=====================" << endl; cout << "=nickname: muhakemos=" << endl; cout << "= team: no team =" << endl; cout << "= Solo Player =" << endl; cout << "= No friends =" << endl; cout << "=====================" << endl; return 0; }

22nd Oct 2018, 3:42 PM
Ardho Ainullah
Ardho Ainullah - avatar
2 Answers
+ 1
You can color the text by using the stdlib.h library (c language) that contains the system color function. Its syntax is system("COLOR XY"); where X and Y are two hexadecimal numbers, the first defines the background color and the second the foreground color. 0 = Black 1 = Blue 2 = Green 3 = Aqua 4 = Red 5 = Purple 6 = Yellow 7 = White 8 = Gray 9 = Light Blue A = Light Green B = Light Aqua C = Light Red D = Light Purple E = Light Yellow F = Bright White
22nd Oct 2018, 4:01 PM
Angelo
Angelo - avatar
+ 1
just an addition, it's not crossplatform thing but correct me if i'm wrong above code are windows
22nd Oct 2018, 4:14 PM
Taste
Taste - avatar