7.11 animals.c 程序

#include <stdio.h>
#include <ctype.h>
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;
}

7.11 animals.c 程序的更多相关文章

  1. Python 爬取 11 万 Java 程序员信息竟有这些重大发现!

    一提到程序猿,我们的脑子里就会出现这样的画面: 或者这样的画面: 心头萦绕的字眼是:秃头.猝死.眼镜.黑白 T 恤.钢铁直男-- 而真实的程序猿们,是每天要和无数数据,以及数十种编程语言打交道.上能手 ...

  2. spark学习11(Wordcount程序-本地测试)

    wordcount程序 文件wordcount.txt hello wujiadong hello spark hello hadoop hello python 程序示例 package wujia ...

  3. Spark教程——(11)Spark程序local模式执行、cluster模式执行以及Oozie/Hue执行的设置方式

    本地执行Spark SQL程序: package com.fc //import common.util.{phoenixConnectMode, timeUtil} import org.apach ...

  4. 1-1 Windows应用程序的特点

    主要内容:介绍Windows应用程序的特点,并附加了消息和事件的一些区别 //以后该分类中字体均采用 隶书 4(14pt) 1. 面向对象 <1>针对Windows应用本身,如记事本界面, ...

  5. 第1节 MapReduce入门:11、mapreduce程序的入门-2

    1.5.WordCount示例编写 1.JobMain.java类 package cn.itcast.wordcount; import org.apache.hadoop.conf.Configu ...

  6. 第1节 MapReduce入门:11、mapreduce程序的入门

    1.1.理解MapReduce思想 MapReduce思想在生活中处处可见.或多或少都曾接触过这种思想.MapReduce的思想核心是“分而治之”,适用于大量复杂的任务处理场景(大规模数据处理场景). ...

  7. 深入刨析tomcat 之---第8篇 how tomcat works 第11章 11.9应用程序,自定义Filter,及注册

    writed by 张艳涛, 标签:全网独一份, 自定义一个Filter 起因:在学习深入刨析tomcat的学习中,第11章,说了调用过滤链的原理,但没有给出实例来,自己经过分析,给出来了一个Filt ...

  8. C Primer Plus(第五版)7

    第 7 章 C 控制语句:分支和跳转 在本章中你将学习下列内容: · 关键字:if(如果),else(否则),switch(切换),continue(继续),break(中断), case(情况),d ...

  9. Gvim自动编译运行c++11的程序

    gcc中对c++11的支持是默认不开启的,要想在实现对其的成功编译,需要添加参数-std=c++11: g++ -o test.exe test.cpp g++ -o test.exe test.cp ...

随机推荐

  1. 为什么想起开通blog?

    为什么想起开通博客 2016年跨年夜写年终总结时,曾对自己许下愿,要成为一个会讲“故事”的人,无奈口才不行,写字也不好看,所以只能在电脑上码码字代替了. 在我看来,这“故事”该有许多种含义:首先,电子 ...

  2. jasperreports+IReport 5.56,集成到Spring MVC4.0案例

    首先,先说一下需求,项目需要打印一些报表,也没多想,直接就在jsp页面设置了样式,前台直接调用window.print()写了打印功能,但是例会的时候,领导提出需要一些比较麻烦的打印,自己写肯定费时间 ...

  3. JavaScript作用域[[scope]]

    [[scope]] : 隐式的属性 每个JavaScript函数都是一个对象,对象中有些属性可以访问,而有些属性是不可以访问的,这些属性仅供JavaScript引擎存取, [[scope]]就是其中一 ...

  4. header头 下载文件 参数详解

    header( header( header( header( header( header( header( header( header( //2 浏览器不会响应缓存 //1 Public指示响应 ...

  5. [转]大白话讲解Promise(一)

    http://www.cnblogs.com/lvdabao/p/es6-promise-1.html 去年6月份, ES2015正式发布(也就是ES6,ES6是它的乳名),其中Promise被列为正 ...

  6. JavaScript语言里判断一个整数,属于哪个范围:大于0;小于0;等于0

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  7. nodejs故障cnpm没反应

    莫名发生的故障cnpm没反应 重新整理nodejs使用流程 方案1 1.安装64位nodejs 2.设置代理 npm config set proxy http://127.0.0.1:9999    ...

  8. 通过sql查找指定字段存在哪些表中

    select * from INFORMATION_SCHEMA.columns where COLUMN_NAME Like '%order_type%';

  9. The listener supports no services

    问题描述 sql> lsnrctl start 提示: The listener supports no services The command completed successfully ...

  10. String对象的属性和方法

    String对象的属性和方法   创建字符串的两种方法: 1.直接量:var str = ""; 2.字符串对象创建: new String(""); Stri ...