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

Recommended Answers

All 2 Replies

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

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

Very good Sir!

Thanks alot.

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.