qiuqiuyaq 2021-08-18 01:32 采纳率: 97.9%
浏览 132
已结题

dafault的作用是什么🤔能不能解释下

![img]( https://img-// Code file created by C Code Develop

#include "ccd.h"
#include "stdio.h"
#include "stdlib.h"

int main(int argc, char **argv)
{
char ch;
printf("give me a letter of the alphabet,and i will give");
printf("an animal name\nbeginning with that letter") ;
printf(" please type in a letter;type # to end it\n");
while((ch = getchar()) != '#')
{
if(ch == '\n')
continue;
if('a' <= ch&&ch <= 'z')
switch (ch)
{
case'a':
printf("argali,hhhh\n");
break;
case'b':
printf("babirusa,hhh\n");
break;
case'c':
printf("coati,hhhh\n");
break;
case'd':
printf("desman,hhhh\n");
break;
case'e':
printf("echidna,hh\n");
break;
case'f':
printf("fisher,hhh\n");
break;
dafault:
printf("that's a stumper\n");
}
else
printf("i don't know\n");
while(getchar() != '\n')
continue;
printf("please type another letter or a #");

}
printf("bye\n");
return 0;

}

.cn/release/static/image/mid/ask/263781122926159.png 'CCDAD01D-C7C4-4D7C-B80E-49675934A520.png')

img

img

  • 写回答

2条回答 默认 最新

  • Pliosauroidea 2021-08-18 02:26
    关注

    default是说如果你所有的case都不满足就执行default
    这一条是为了防止Switchcase无法覆盖所有结果,或是简写不需要分支处理的条件判断

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 8月18日
  • 已采纳回答 8月18日
  • 创建了问题 8月18日

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大