How to have a text which is in highlight form

Oct 20, 2010 at 2:57pm
hello...
does anyone know how to highlight the text in c++?


i only use:
textcolor and textbackground

and i want my text in highlight form..
what will i do to make it?
Oct 20, 2010 at 3:00pm
What library are you using for text coloring (I'm assuming this is console programming)? That's going to make an impact on how you're going to change the highlighting color.

-Albatross
Last edited on Oct 20, 2010 at 3:00pm
Oct 20, 2010 at 3:06pm
im just using Windows XP for this turbo c++

can u show me what kind of code will i use to make my text in highlight form when i print it?
Oct 20, 2010 at 3:15pm
Are you using any special #include 's? Anything other than, I don't know, stdio, iostream, etc?

Because if you're not, then you're stuck with the console and it's beautiful black-and-white display. And when you say "textcolor and textbackground," do you mean the things in the Properties page of your compiler? Because that's probably just the color of the code you write, not the color of the stuff you print on the screen while the program is running.
Oct 20, 2010 at 3:22pm
this is the code i have done..
but i really don't know how could i make my text in highlight form..



#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<stdio.h>



void main()
{
clrscr();
textcolor(0);
textbackground(7);

int x,y,z,a,n,o,m,c,d;

{

for(x=1;x<=1;x++)
{
//first line upper
for(y=15;y<=64;y++)
{
gotoxy(y,x=5);
textbackground(4);
cout<<"_";
delay(50);
}
}
//second line right side
{
for(z=6;z<=20;z++)
{
gotoxy(x=65,z);
cout<<"|"<<endl;
delay(50);
}
}
{
//fourth line bottom
for(m=64;m>=15;m--)
{
gotoxy(m,x=20);
cout<<"_";
delay(50);
}
}

//third line left side downward
{
for(z=20;z>=6;z--)
{
gotoxy(x=14,z);
cout<<"|";
delay(50);
}
}

}

{
gotoxy(30,12);
cout<<"Loading...\n";
gotoxy(30,14);
cout<<"* * * * * * * * * *";
gotoxy(49,16);
cout<<"0%";
delay(1000);
}

{
gotoxy(30,12);
cout<<"Loading...\n";
gotoxy(30,14);
cout<<"- * * * * * * * * *";
gotoxy(49,16);
cout<<"10%";
delay(1000);
}

{
gotoxy(30,12);
cout<<"Loading...\n";
gotoxy(30,14);
cout<<"- - * * * * * * * *";
gotoxy(49,16);
cout<<"20%";
delay(1000);
}

{
gotoxy(30,12);
cout<<"Loading...\n";
gotoxy(30,14);
cout<<"- - - * * * * * * *";
gotoxy(49,16);
cout<<"30%";
delay(1000);
}

{
gotoxy(30,12);
cout<<"Loading...\n";
gotoxy(30,14);
cout<<"- - - - * * * * * *";
gotoxy(49,16);
cout<<"40%";
delay(1000);
}

{
gotoxy(30,12);
cout<<"Loading...\n";
gotoxy(30,14);
cout<<"- - - - - * * * * *";
gotoxy(49,16);
cout<<"50%";
delay(1000);
}

{
gotoxy(30,12);
cout<<"Loading...\n";
gotoxy(30,14);
cout<<"- - - - - - * * * *";
gotoxy(49,16);
cout<<"60%";
delay(1000);
}

{
gotoxy(30,12);
cout<<"Loading...\n";
gotoxy(30,14);
cout<<"- - - - - - - * * *";
gotoxy(49,16);
cout<<"70%";
delay(1000);
}

{
gotoxy(30,12);
cout<<"Loading...\n";
gotoxy(30,14);
cout<<"- - - - - - - - * *";
gotoxy(49,16);
cout<<"80%";
delay(1000);
}

{
gotoxy(30,12);
cout<<"Loading...\n";
gotoxy(30,14);
cout<<"- - - - - - - - - *";
gotoxy(49,16);
cout<<"90%";
delay(1000);
}

{
gotoxy(30,12);
cout<<"Loading...\n";
gotoxy(30,14);
cout<<"- - - - - - - - - - ";
gotoxy(49,16);
cout<<"100%";
delay(1000);
}









//after loading.. ^^,

clrscr();
textcolor(WHITE+BLINK);
textbackground(6);
char choice;

cout<<"\n\t\t\t Republic of The Philippines\n";
cout<<"\t\t\t AMA Computer Learning Center\n";
cout<<"\t\t\t\t Cabanatuan City\n\n\n";
textbackground(5);
cout<<"\t\t\t\t[A] - Programmer\n\n";
cout<<"\t\t\t\t[M] - Multiplication Table\n\n";
cout<<"\t\t\t\t[X] - Exit\n\n\n\n\n";
cout<<"\t\t\t\tEnter Your Choice: ";
cin>>choice;


switch(choice)
{
case 'A': case 'a':
{
clrscr();
cout<<"\n\t\t\t\tProgrammer /3\n\n\n";
cout<<"\t\tName: Novie F. Mangalinao\n\n";
cout<<"\t\tAge: 18 yrs. old\n\n";
cout<<"\t\tBirthday: March 18, 1992\n\n";
cout<<"\t\tAddress: 61 San Pedro Sta. Rosa, Nueva Ecija\n\n";
cout<<"\t\tSchool: AMA Computer Learning Center\n\n";
cout<<"\n\t\tMotto: Better to be Hated for who I am,";
cout<<"\n\t\t\t than Loved for who I am not""";
cout<<"\n\n\n\n\n\t\t\tPress [X] to Exit..";

break;
}
case 'M': case 'm':
{
clrscr();
int n,o;
cout<<"\n\t\t\t\tMULTIPLCATION TABLE\n\n";
delay(300);
for(n=1;n<=10;n++)
{
for(o=1;o<=10;o++)
cout<<n*o<<"\t";
delay(500);
cout<<endl;
}
break;
}

case 'X': case 'x':
{
clrscr();
cout<<"\n\n\n\t Press the following to exit from the Command Prompt:";
cout<<"\n\n\n\n\n\t\t\t\t1.) Press ANY KEY";
cout<<"\n\n\t\t\t\t2.) Press ALT + X";
cout<<"\n\n\t\t\t\t3.) Type the word EXIT";
break;
}

default:
cout<<"\n\n\t\t\t\tNone of the Choices!";

}


getch();
}
Oct 21, 2010 at 2:54am
You need to set the background color to something other than black. Use the TextAttributes variable or the SetBkColor() function (I think, look it up in your documentation).

Hope this helps.
Topic archived. No new replies allowed.