Blink and color text using textcolor () - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Blink and color text using textcolor ()

Ashu2912Ashu2912 Posts: 23Member
While executing the below code, I expected to get the PLAYER MENU string in red and blinking mode. However, I do not get so. Please help me as I need to get this code ready ASAP.

Note : Have tried textattr () function as well. I'm using Turbo C++ Version 3.0.

PS : Sorry for posting such a long code for such a minor error. Thank you for your time and energy.


See this code:

void menu ()
{
int x1, y1, x2, y2, x3, y3;
char choice;
textcolor (YELLOW);
textbackground (0);
do
{
clrscr ();
disptime ();
cout << " ";
x1 = wherex ();
y1 = wherey ();
for (int i = 1; i <= 55; i ++)
cout << "_";
x2 = wherex () - 1;
y2 = wherey ();
gotoxy (x1, y1 + 1);
cout << "|";
gotoxy (x2, y2 + 1);
cout << "|";
gotoxy (x1, y1 + 2);
cout << "|";
gotoxy (x2, y2 + 2);
cout << "|";
gotoxy (x1, y1 + 3);
cout << "|";
textcolor (RED + BLINK);
cout << " PLAYER MENU";
textcolor (YELLOW);
gotoxy (x2, y2 + 3);
cout << "|";
gotoxy (x1, y1 + 4);
cout << "|";
gotoxy (x2, y2 + 4);
cout << "|";
gotoxy (x1, y1 + 5);
cout << "|";
cout << " (1) Enter new player";
gotoxy (x2, y2 + 5);
cout << "|";
gotoxy (x1, y1 + 6);
cout << "|";
cout << " (2) Update player details";
gotoxy (x2, y2 + 6);
cout << "|";
gotoxy (x1, y1 + 7);
cout << "|";
cout << " (3) Modify player details";
gotoxy (x2, y2 + 7);
cout << "|";
gotoxy (x1, y1 + 8);
cout << "|";
cout << " (4) Search player";
gotoxy (x2, y2 + 8);
cout << "|";
gotoxy (x1, y1 + 9);
cout << "|";
cout << " (5) Delete player";
gotoxy (x2, y2 + 9);
cout << "|";
gotoxy (x1, y1 + 10);
cout << "|";
cout << " (6) Hourly Lucky Draw";
gotoxy (x2, y2 + 10);
cout << "|";
gotoxy (x1, y1 + 11);
cout << "|";
cout << " (7) Silver Club Championship";
gotoxy (x2, y2 + 11);
cout << "|";
gotoxy (x1, y1 + 12);
cout << "|";
cout << " (8) Instruction manual";
gotoxy (x2, y2 + 12);
cout << "|";
gotoxy (x1, y1 + 13);
cout << "|";
cout << " (9) System Settings";
gotoxy (x2, y2 + 13);
cout << "|";
gotoxy (x1, y1 + 14);
cout << "|";
cout << " (0) Exit";
gotoxy (x2, y2 + 14);
cout << "|";
gotoxy (x1, y1 + 15);
cout << "|";
gotoxy (x2, y2 + 15);
cout << "|";
gotoxy (x1, y1 + 16);
cout << "|";
cout << " Enter your choice here :- ";
x3 = wherex ();
y3 = wherey ();
gotoxy (x2, y2 + 16);
cout << "|";
gotoxy (x1, y1 + 17);
cout << "|";
gotoxy (x2, y2 + 17);
cout << "|";
gotoxy (x1, y1 + 18);
cout << "|";
gotoxy (x2, y2 + 18);
cout << "|";
gotoxy (x1, y1 + 19);
cout << "|";
gotoxy (x2, y2 + 19);
cout << "|";
gotoxy (x1, y1 + 20);
cout << "|";
gotoxy (x2, y2 + 20);
cout << "|";
gotoxy(x1, y1 + 20);
for (i = 1; i <= 55; i ++)
cout << "-";
gotoxy (x3, y3);
choice = getche ();
switch (choice)
{
case '1' : newplayer ();
break;
case '2' : update ();
break;
case '3' : break;
case '4' : break;
case '5' : break;
case '6' : break;
case '7' : break;
case '8' : break;
case '9' : break;
case '0' : break;
default : gotoxy (x1 + 1, y1 + 18);
cout << " Invalid choice. Try again!!!";
getch ();
}
} while (choice != '0');
}

Comments

Sign In or Register to comment.