I'm using system("color __"); and system("title ____"); in my code and I'm struggling on how to change them according to the input.

eg. if the user enters he wants green background and yellow words ... i'm stuck with 2 variables (i would convert them to 2 and 6 [the numbers for the colors]) so how do i get the computer to put it into a the system function in c++?

aka fill in the blank: system("color __");
so it would mean the same as system("color 26");


thanks in advance

1) Dont use system's command

2) To answer your question something like this : ?

string command = "color ";
string input = "";
cin >> input;
command += input;
system(command.c_str());

1) Dont use system's command

2) To answer your question something like this : ?

string command = "color ";
string input = "";
cin >> input;
command += input;
system(command.c_str());

Thank you soo much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.