C语言程序设计50例(经典收藏)

2020-01-06 20:20:54王冬梅

        printf("saturdayn");
        else if ((letter=getch())=='u')
          printf("sundayn");
          else printf("data errorn");
      break;
      case 'F':printf("fridayn");break;
      case 'M':printf("mondayn");break;
      case 'T':printf("please input second lettern");
      if((letter=getch())=='u')
        printf("tuesdayn");
        else if ((letter=getch())=='h')
          printf("thursdayn");
        else printf("data errorn");
      break;
      case 'W':printf("wednesdayn");break;
      default: printf("data errorn");
    }
  }
  getch();
}
==============================================================
【程序32】
题目:Press any key to change color, do you want to try it. Please hurry up!
1.程序分析:            
2.程序源代码:
复制代码
#include "conio.h"
#include "stdio.h"
void main(void)
{
  int color;
  for (color = 0; color < 8; color++)
  {
    textbackground(color);/*设置文本的背景颜色*/
    cprintf("This is color %drn", color);
    cprintf("Press any key to continuern");
    getch();/*输入字符看不见*/
  }
}
==============================================================
【程序33】
题目:学习gotoxy()与clrscr()函数