设置文本及背景颜色
#include<conio.h>
main()
{
??? void *buf;
??? clrscr();???????????/*清除字符屏幕*/
??? gotoxy(35,15);??????????/*光標定位到(35,15)*/
??? textcolor(YELLOW);?????????/*設置文本顏色為黃色*/
??? textbackground(BLUE);?????????/*設置背景顏色為藍色*/
??? cprintf("hello world\n");?????????/*輸出字符串hello world*/
??? cprintf("hello computer\n");????????/*輸出字符串hello computer*/
??? buf=(char *)malloc(2*11*2);????????/*buf指向分配的內存空間*/
??? gettext(35,15,60,16,buf);????????/*保存指定范圍內的文本到內存中*/
??? puttext(20,5,45,6,buf);?????????/*將在內存中保存的文本輸出*到指定位置*/
??? gotoxy(30,10);??????????/*光標定位到(30,10)*/
??? textattr(RED|128|GREEN*16);???????/*用textattr設置文本屬性*/
??? cprintf("Moring");??????????/*輸出字符串Morning*/
? }
main()
{
??? void *buf;
??? clrscr();???????????/*清除字符屏幕*/
??? gotoxy(35,15);??????????/*光標定位到(35,15)*/
??? textcolor(YELLOW);?????????/*設置文本顏色為黃色*/
??? textbackground(BLUE);?????????/*設置背景顏色為藍色*/
??? cprintf("hello world\n");?????????/*輸出字符串hello world*/
??? cprintf("hello computer\n");????????/*輸出字符串hello computer*/
??? buf=(char *)malloc(2*11*2);????????/*buf指向分配的內存空間*/
??? gettext(35,15,60,16,buf);????????/*保存指定范圍內的文本到內存中*/
??? puttext(20,5,45,6,buf);?????????/*將在內存中保存的文本輸出*到指定位置*/
??? gotoxy(30,10);??????????/*光標定位到(30,10)*/
??? textattr(RED|128|GREEN*16);???????/*用textattr設置文本屬性*/
??? cprintf("Moring");??????????/*輸出字符串Morning*/
? }
總結
- 上一篇: const 常量
- 下一篇: Java动态代理的应用