C++ how to align text to middle with color -


i looked how change text color std::cout in c++, , told use enum, don't know is. started learning few days ago.

i need centering text while keeping color in. easier ways?

i want center "what's name?" , keep colors.

enum colors { blue = 1, green, cyan, red, purple, yellow, grey, dgrey, hblue, hgreen, hred, hpurple, hyellow, hwhite };  void coutc(int color, char* output) {     handle handle = getstdhandle(std_output_handle);     setconsoletextattribute(handle, color);     cout << output;     setconsoletextattribute(handle, color); }  int main() {     coutc(hred, "whats name?");      string name = "";      cin >> name;      cout << "hi " << name << endl; } 


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -