首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
请补充main函数,该函数的功能是:把字符串str1中的非空格字符拷贝到字符串str2中。 例如,若sffl=“glad to see you!”, 则str2=“gladtoseeyou!”。 注意:部分源程序给出如下。 请勿改动
请补充main函数,该函数的功能是:把字符串str1中的非空格字符拷贝到字符串str2中。 例如,若sffl=“glad to see you!”, 则str2=“gladtoseeyou!”。 注意:部分源程序给出如下。 请勿改动
admin
2010-09-14
22
问题
请补充main函数,该函数的功能是:把字符串str1中的非空格字符拷贝到字符串str2中。
例如,若sffl=“glad to see you!”,
则str2=“gladtoseeyou!”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#define N 80
main()
{
static char strl [N] ="glad to see you!";
char str2 IN];
int i=0, j=0;
clrscr ();
printf("\n***** strl*****\n ");
puts (str1);
while (str1
)
{
if(【 】)
str2 [J++] =strl
;
【 】;
}
printf("\n***** str2 *****\n ");
for (i=0; i<j; i++)
printf ("%c", str2
);
}
选项
答案
str1[i]!=’’ i++
解析
第一空:如果当前字符不为空格,则将它保存在字符串str2中。第二空:在while循环中,通过1忖取得字符串str1中当前字符的下一个字符,继续判断是否为空格。
转载请注明原文地址:https://kaotiyun.com/show/uWID777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下列叙述中,错误的是()。
国际收支平衡表的四部分主要内容中,最基本的项目是()。
近些年.我国取得了一批重大科技创新成果,实现部分领域由“跟随”到“领跑”的跨越。以下说法不正确的是()。
俄国十月革命以前,我国新文化运动的主要内容是()。①提倡民主与科学,反对专制和愚昧②提倡新道德,反对旧道德③提倡马克思主义,反对资产阶级改良主义④提倡新文学,反对旧文学
政府为了保护农业生产者,对部分农业产品规定了保护价格。为了采取这种价格政策,应采取的相应措施是()。
编号从1到10的10个白球排成一行,现按照如下方法涂红色:①涂2个球:②被涂色的2个球的编号之差大于2。那么不同的涂色方法有多少种?
如图所示,X、Y、Z分别是面积为64、180、160的三张不同形状的纸片。它们部分重叠放在一起盖在桌面上,总共盖住的面积为290。且X与Y、Y与Z、Z与X重叠部分面积分别为24、70、36。问阴影部分的面积是多少?
随机试题
净土宗的祖庭是()。
A、SheusedtorelaxbytheDeadSeawithherfamilyonSaturdays.B、ShefirstexperimentedcreatingartintheDeadSeawhenshe
确定乳腺叶状肿瘤的良恶性指标,应除外
图示结构由不计自重的AD、BH和EC三杆铰接组成,A为固定铰支座,BH杆的H端与光滑平面接触,如图所示。若力P已知,L=1m,则铰链B的约束反力为()。
CBOT允许交易商以对冲方式免除履约责任的具体时间是()。
下列项目中不属于有价证券的是()。
被派遣劳动者的管理具有特殊性,主要体现在()。
政府机构是()。
1904年圣路易奥运会上,10米跳台跳水成为正式比赛项目,可惜当时还没有多少__________,只能比赛谁跳得更远,美国人谢尔登赢得了奥运历史上第一块跳水金牌。从早期的瑞典、德国__________到美国一枝独秀,从俄罗斯崭露头角到中国后来居上,尽管“百
设随机变量X在[2.5]上服从均匀分布,现对X进行3次独立观测,求3次观测中至少有两次出现事件{X>3}的概率为_____.
最新回复
(
0
)