How Do You Make A Text BLINK In C++ Programming?

3

3 Answers

Patrick Caron Profile
Patrick Caron answered
There are many ways to make text blink depending of the context and what functions you used to draw the text.  You need to be more specific as to what you are doing.  Personally since I used the .NET framework  I would use some sort of timer to go from one color to the other using the (System.Drawing.Graphics) methods DrawRectangle() for the background color change and DrawString() for the text.
Lloyd Bellodo Profile
Lloyd Bellodo answered
You can make a blinking effect on C++ by displaying a text, wait for some time then erasee it, wait again then loop. Below is a sample function that you can use:

supply the following
text - the text you would like to blink
x - x location or the column
y - y location or the row

for the gotoxy() work, you must:

#include

here's the code:

void blink(char text[50], int x, int y)
{
while (true) //loop infinitely
{
gotoxy(x,y); //go to the specified x and y location
cout
JJJJJJ BBBBBB Profile
JJJJJJ BBBBBB answered
The code suggested above will burn up tons of CPU cycles and is very inefficient.

What you are looking for is how to use ANSI commands.  Here is a good definition: en.wikipedia.org

Answer Question

Anonymous