首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include int fun(char p[][10]) { int n=0,i; for(i=0; i<7; i++) if(p[i][0]== ’T’) n++; return n; } main() { char str[]
有以下程序 #include int fun(char p[][10]) { int n=0,i; for(i=0; i<7; i++) if(p[i][0]== ’T’) n++; return n; } main() { char str[]
admin
2020-05-19
25
问题
有以下程序
#include
int fun(char p[][10])
{ int n=0,i;
for(i=0; i<7; i++)
if(p
[0]== ’T’) n++;
return n;
}
main()
{ char str[][10]={"Mon","Tue","Wed","Thu","Fri","Sat","Sun"};
printf("%d\n",fun(str));
}
程序执行后的输出结果是
选项
A、1
B、2
C、3
D、0
答案
B
解析
此程序是统计一周七天中英文名称首字母为"T"的个数。P[i][0]是字符串的首字符,一共有两个"T",所以n=2。因此B选项正确。
转载请注明原文地址:https://kaotiyun.com/show/LuCp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下列选项中不属于结构化程序设计原则的是()。
与语句:k=a>b?(b>c?1:0):0;功能相同的是()。
以下程序的输出结果是()。#includeintfun(chars[]){char*p=s;while(*p!=0)p++;return(p一s);}main(){printf(’’%d\n’’,fun(’’0ABCDEF’’));}
若各选项中所用变量已正确定义,函数fun中通过return语句返回一个函数值,下列选项中错误的程序是()。
数据库设计中反映用户对数据要求的模式是()。
C语言规定,在一个C程序中,main()函数的位置()。
软件测试的目的是()。
深度为5的完全二叉树的结点数不可能是()。
数据字典(DD)所定义的对象都包含于
软件生命周期可分为定义阶段、开发阶段和维护阶段,下面属于开发阶段任务的是
随机试题
《声声慢》是一首慢词,婉约词,是作者前期词的代表作品。()
下列情况中,交割仓库应承担赔偿责任的有()。
1689年《权利法案》颁布的主要意义在于()。
如果你打算拍一部以18世纪的英国为背景的影片,下列不可能在影片中出现的情景是()。
AftertheWarofIndependence,Americansdesignedanewsystem.Whatit?
Therearevariouswaysinwhichindividualeconomicunitscaninteractwithoneanother.Threebasicwaysmaybedescribedasth
A、Stomachcancer.B、Skincancer.C、Lungcancer.D、Bloodcancer.AA是老师提到阳光可以防御癌症后列举的例子之一。B是曝晒导致的。
A、Seeifhequalifiesforastudentloan.B、Makeaproposaltothegovernment.C、Starttosaveuptopayforhiskidstogotos
FootballandMoneyWhywasitfootball,ratherthantheothergreatVictoriansports,thatcapturedtheworld?Onereasonma
A、Whethertoaccepthisboss’sjoboffer.B、Whethertoapplytotransfertoanotherplace.C、Whethertofindanewjob.D、Whethe
最新回复
(
0
)