Program #14
Description:
Set text color as well background color in C Program.
#include<stdio.h>
#include<conio.h>
int main(void)
{
int i;
clrscr();
for (i=0; i<15; i++)
{
/* Just positioning to center */
gotoxy(30,i+1);
cprintf("Let Us C");
cprintf("\r\n");
/* set text color */
textcolor(i+1);
/* set background color */
textbackground(i);
}
getch();
return 0;
}
Description:
Set text color as well background color in C Program.
#include<stdio.h>
#include<conio.h>
int main(void)
{
int i;
clrscr();
for (i=0; i<15; i++)
{
/* Just positioning to center */
gotoxy(30,i+1);
cprintf("Let Us C");
cprintf("\r\n");
/* set text color */
textcolor(i+1);
/* set background color */
textbackground(i);
}
getch();
return 0;
}
In this program the gotoxy is used to mention the axis?
ReplyDeleteIn for loop if i give the value for i<20 it print the upto 20 different colors?
Yes, gotoxy() funtion used to position the cursor. But we can't increase i value to get 20 different colors. Same colors will get repeated. Just try 20 and run it!!
ReplyDeleteyes, I have try it i value upto 30 then i get only the repeated colors only that's you are right.
DeleteYes, gotoxy() funtion used to position the cursor. But we can't increase i value to get 20 different colors. Same colors will get repeated. Just try 20 and run it!!
ReplyDelete