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.

Answers


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.


Need Your Help

Sending an API CAll with PayPal SOAP API

c# paypal paypal-soap

Ok, so I have the service reference in my .NET project. And yes I know that you now have access to proxy classes.

AngularJS: Add Elements to <li> dynamically

javascript jquery angularjs

I am unable to populate list on clicking Add button. Problem is when I change the text field again, My List data gets changed (binding), how to avoid that?