article

Colored Text

Email
Submitted on: 1/1/2015 11:21:00 PM
By: Kevin Browns (from psc cd)  
Level: Beginner
User Rating: By 6 Users
Compatibility: C++ (general), Borland C++
Views: 686
 
     This program is a very basic animation. It uses the conio.h header file. It goes to the center of the screen, sets the text color, pauses for a second, and then resets the text and background color and prints more text. This is a verrrrrrrry basic animation.


 
				#include stdio.h
#include conio.h//you MUST have this header for this prog to work
#include dos.h//for the sleep() function
void ColoredText();//prototype for text doloring function
int main() {
ColoredText();//calling of the function
}
void ColoredText() {//Ladies and Gentlemen...The function!!

clrscr();//we clear the screen
gotoxy(24,1);//go to the 'x' 24 and the 'y' 1
textcolor(GREEN);//set the text to green
//the color has to be

uppercase
cprintf("This is it!!");//the 'c' before the sleep(1);//take a good look at it for 1
second
textcolor(BLUE);//reset the text color
textbackground(YELLOW);//Hey! Advanced!
setting the backround behind the text to
yellow
clrscr();//clearing the screen
gotoxy(24,1);//moving to the center
cprintf("More of it!");//again we print
sleep(1);//zzzzzzz!
clrscr();//finally clearing the screen
}


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.