Please suggest something better than gotoxy function in C++
I have written a program that consists of multiples and multiples of function each of which are printing several things on the console when control is passed to them. Now I am trying to print everything in the center of the screen rather than on the upper left corner of the screen. For that purpose, the only thing I know is the gotoxy function of Windows.h. Now this would be an extremely hectic job because I would have to place gotoxy above each "cout". Is there a way that I set the cursor to a particular position on the screen and every time anything gets printed, the printing commences from that particular position.
Write a small helper function (e.g. printCentered(std::string) ) that receives the string to be printed. This function moves the cursor to the center and then prints the parameter. Then replace your couts with a call to this function.