1.程序分析:
2.程序源代码:
复制代码
#include "conio.h"
#include "stdio.h"
void main(void)
{
clrscr();/*清屏函数*/
textbackground(2);
gotoxy(1, 5);/*定位函数*/
cprintf("Output at row 5 column 1n");
textbackground(3);
gotoxy(20, 10);
cprintf("Output at row 10 column 20n");
getch();
}
==============================================================
【程序34】
题目:练习函数调用
1. 程序分析:
2.程序源代码:
复制代码
#include "stdio.h"
#include "conio.h"
void hello_world(void)
{
printf("Hello, world!n");
}
void three_hellos(void)
{
int counter;
for (counter = 1; counter <= 3; counter++)
hello_world();/*调用此函数*/
}
void main(void)
{
three_hellos();/*调用此函数*/
getch();
}
==============================================================
【程序35】
题目:文本颜色设置
1.程序分析:
2.程序源代码:
复制代码
#include "stdio.h"
#include "conio.h"
void main(void)
{
int color;
for (color = 1; color < 16; color++)
{
textcolor(color);/*设置文本颜色*/
cprintf("This is color %drn", color);
}
textcolor(128 + 15);










