博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
7.11 animals.c 程序
阅读量:4635 次
发布时间:2019-06-09

本文共 1530 字,大约阅读时间需要 5 分钟。

7.11 animals.c 程序

#include 
#include
int main(void){ char ch; printf("Give me a letter of the alphabet, and I will give "); printf("an animal name\nbeginning with that letter.\n"); printf("Please type in a letter; type # to end my act.\n"); while ((ch = getchar()) != '#') { if ('\n' == ch) // 不会担心变成赋值语句 continue; if (islower(ch)) /* 只接受小写字母 */ switch (ch) { case 'a': printf("argali, a wild sheep of Asia\n"); break; case 'b': printf("babirusa, a wild pig of Malay\n"); break; case 'c': printf("coati, racoonlike mammal\n"); break; case 'd': printf("desman, aquatic, molelike critter\n"); break; case 'e': printf("echidna, the spiny anteater\n"); break; case 'f': printf("fisher, brownish marten\n"); break; default: printf("That's a stumper!\n"); } /* switch 结束 */ else printf("I recognize only lowercase letters.\n"); while (getchar() != '\n') continue; /* 跳过输入行的剩余部分 */ printf("Please type another letter or a #.\n"); } /* while循环结束 */ printf("Bye!\n"); return 0;}

转载于:https://www.cnblogs.com/EisNULL/p/10702906.html

你可能感兴趣的文章
RAID详解[RAID0/RAID1/RAID10/RAID5]
查看>>
MySQL 基础内容
查看>>
导航条——收缩式导航菜单
查看>>
经常使用ARM汇编指令
查看>>
函数指针&绑定: boost::functoin/std::function/bind
查看>>
js实现双击后网页自己主动跑-------Day55
查看>>
TMS320F28335项目开发记录2_CCS与JTAG仿真器连接问题汇总
查看>>
PS多形式的部分之间复制“笨办法”
查看>>
最强的篮球队和马尔可夫模型
查看>>
hdu-4302-Holedox Eating-线段树-单点更新,有策略的单点查询
查看>>
cocos2d-x 音效中断问题
查看>>
设计模式简要笔记
查看>>
子分类账知识学习(汇总网上比较有用的资料)
查看>>
关于JQuery中的ajax请求或者post请求的回调方法中的操作执行或者变量修改没反映的问题...
查看>>
pyQt 每日一练习 -- 登录框
查看>>
wp 删除独立存储空间文件(多级非空文件夹删除)
查看>>
Loadrunner安装使用入门
查看>>
smartupload 上传文件时 把页面编码改成gbk 解决乱码
查看>>
EPS是什么格式
查看>>
新闻网大数据实时分析可视化系统项目——5、Hadoop2.X HA架构与部署
查看>>