________________
程序分析:用情况语句比较好,如果第一个字母一样,则判断用情况语句或if语 句判断第二个字母。
___________________________________________________________________
程序源代码:
#include <stdio.h> void main() { char letter;
printf(\while
((letter=getch())!='Y') /*当所按字母为Y时才结束*/ { switch (letter) {case
'S':printf(\letter\\n\
if((letter=getch())=='a')
printf(\ else if ((letter=getch())=='u')
printf(\ else printf(\ break; case
'F':printf(\case 'M':printf(\case
'T':printf(\letter\\n\
if((letter=getch())=='u') printf(\ else if ((letter=getch())=='h')
printf(\ else printf(\ break; case
'W':printf(\default: printf(\error\\n\ } } }
题目:Press any key to change color, do you want to try it. Please hurry up!
___________________________________________________________________
程序源代码:
#include <conio.h> void main(void) { int color;
for (color = 0; color < 8; color++) {
textbackground(color); /*设置文本的背景颜色*/ cprintf(\color);
cprintf(\ getch(); /*输入字符看不见*/ } }
题目:学习gotoxy()与clrscr()函数
___________________________________________________________________
程序源代码:
#include <conio.h> void main(void) { clrscr(); /*清屏函数*/ textbackground(2); gotoxy(1, 5); /*定位函数*/ cprintf(\
row 5 column 1\\n\textbackground(3); gotoxy(20, 10); cprintf(\
at row 10 column 20\\n\}
题目:练习函数调用
___________________________________________________________________
程序源代码:
#include <stdio.h> void
hello_world(void) {
printf(\} void
three_hellos(void) {
int counter;