好文档 - 专业文书写作范文服务资料分享网站

C语言100个经典的算法

天下 分享 时间: 加入收藏 我要投稿 点赞

________________

程序分析:用情况语句比较好,如果第一个字母一样,则判断用情况语句或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;

C语言100个经典的算法

________________程序分析:用情况语句比较好,如果第一个字母一样,则判断用情况语句或if语句判断第二个字母。___________________________________________________________________程序源代码:#include<stdio.h>voi
推荐度:
点击下载文档文档为doc格式
4b7o64f7k102tjb2ixwe3xy6q955i0014qp
领取福利

微信扫码领取福利

微信扫码分享