954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Console Text Alignment!

Hello Guys!

Need some help.

I basically want to align my menu to center. I have tried the following:
1 . SetConsoleCursorPosition();
2. gotoxy();
....etc

But none what so ever works.....

Here is my code menu:

void printMenu()
{

	void Bottomline(char *text);
	void Headline(char *text);
	void EmptyLine();
      
     int ans;
     do
     {
		 
		  cout << "\nPlease choose from the following options:\n\n";
		  cout << "1: Search for a file\n\n";
		  cout << "2: Create a new file\n\n";
		  cout << "3: View entire catalogue\n\n";
		  cout << "4: Exit from the program\n\n";
		  cin  >> ans;
		  Bottomline("End");
          cin.ignore(80,'\n');
          options(ans);	
     }
	 while(ans!=4);
};

Thanks in Advance

rEhSi_123
Junior Poster
159 posts since Feb 2009
Reputation Points: 18
Solved Threads: 0
 

Just put some spaces or tabs, that is, \t characters at the beginning of the menu lines.

nucleon
Posting Pro in Training
478 posts since Oct 2008
Reputation Points: 163
Solved Threads: 91
 
Just put some spaces or tabs, that is, \t characters at the beginning of the menu lines.

Very good Sir!

Thanks alot.

rEhSi_123
Junior Poster
159 posts since Feb 2009
Reputation Points: 18
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You