首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列程序的功能:对输入的一行字符中的数字字符的字面值累加,输出此累加和,请填空。 #include<stdio.h> #include<ctype.h> main() { char c; int a,s=0; while(______) if(isdig
下列程序的功能:对输入的一行字符中的数字字符的字面值累加,输出此累加和,请填空。 #include<stdio.h> #include<ctype.h> main() { char c; int a,s=0; while(______) if(isdig
admin
2010-12-10
18
问题
下列程序的功能:对输入的一行字符中的数字字符的字面值累加,输出此累加和,请填空。
#include<stdio.h>
#include<ctype.h>
main()
{ char c;
int a,s=0;
while(______)
if(isdigit(c))
{a=c-’0’;s+=a;}
printf("s=%d",s);
}
选项
A、(c=getchar())!=’\n’
答案
解析
分析题目可知,程序中运用函数c=getchar()从标准输入设备读取下一个字符,而且是一行的字符(即没有换行),所以条件为(c=getchar())!=’\n’。
转载请注明原文地址:https://kaotiyun.com/show/n2Pp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
在窗体上有一个名称为Command1的命令按钮,并有如下程序:PrivateSubCommand1_Click()StaticXAsIntegerStaticYAsIntegerClsY=1
能够产生1到50之间(含1和50)随机整数的表达式是()。
下列选项中不属于结构化程序设计原则的是( )。
编写如下程序:PrivateSubCommand1_Click()DimiAsInteger,xAsIntegeri=1Whilei
可以产生30~50(含30和50)之间的随机整数的表达式是()。
数据管理技术发展的三个阶段中,()没有专门的软件对数据进行管理。 Ⅰ.人工管理阶段Ⅱ.文件系统阶段Ⅲ.数据库阶段
在数据库设计中,将E-R图转换成关系数据模型的过程属于()。
面向对象方法中,继承是指( )。
下列关于线性链表的叙述中,正确的是( )。
数据结构分为逻辑结构和存储结构,循环队列属于______结构。
随机试题
金属材料的热导率越大,其导热性越好。
属于激素适应证的肾小球疾病中,对激素敏感的多为
甲公司是一家酸奶制品的生产厂家,其生产的“宝宝乐”酸奶畅销全省。某市乙公司亦生产酸奶制品,但由于技术问题,其产品口感差、保质期短,市场销路不旺。乙公司为提高本公司产品的竞争力,花费巨额“技术咨询费”收买甲公司骨干技术人员韩某等人,获取其提供的甲公司技术秘密
全云天时,下列哪项因素对建筑室内采光所产生的天然光照度无影响?(2009,21)
运输易燃、易爆物品的机动车,其排气管应装阻火器,并悬挂“()”标志。
()是指跟踪已识别的风险和识别新的风险,保证风险计划的执行,并评估风险对策与措施的有效性。
“备案号”栏:()。“标记唛码及备注”栏:()。
下列各项费用中,应当计入进口关税完税价格的有()。
已知二维随机变量(X,y)的概率分布为若随机事件{X=0)与{X+Y=1)相互独立,令U=max{X,Y),V=min{X,Y},则P{U+V=1}=()
打开考生文件夹下的演示文稿yswg.pptx,按照下列要求完成对此文稿的修饰并保存。使用“穿越”主题修饰全文。
最新回复
(
0
)