首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include <iostream> using namespace std; int strle(char a[],char b[]) { int num=O,n=O; while (* (
有如下程序: #include <iostream> using namespace std; int strle(char a[],char b[]) { int num=O,n=O; while (* (
admin
2010-03-29
38
问题
有如下程序:
#include <iostream>
using namespace std;
int strle(char a[],char b[])
{
int num=O,n=O;
while (* (a+num) !=’\0’)
num++;
while (b [n] )
{
* (a+num)=b [n];
num++;
n++;
}
return(num);
}
int main ()
{
char strl[80],str2[80],*p1=str1,*p2=str2;
cin>>p1;
cin>>p2;
cout<<strle(p1,p2)<<end1;
return 0;
}
运行上述程序,如果从键盘输入字符串qwerty和字符串abcd,则程序的输出结果是【 】。
选项
答案
10
解析
函数strle()的功能是求出两字符串长度的总和。
转载请注明原文地址:https://kaotiyun.com/show/yDjp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
若有以下程序voidf(intx)main(){intZ=123456;{if(x>=10)f(z);}{printf("%d-",x%10);f(x/10);}
下面程序的运行结果是()。#includevoiddel(char*s){inti,j;char*a;a=s;for(i=0,j=0;a[i]!=’\0’;i++){if(a[i]
当输入为’’Fool&Swalow’’时,下面程序的执行结果是()。#include<stdio.h>main()fcharc;while(c!=’?r1fc=getchar0;putchar(c);}}
定义结构体数组structstu{intnum;charname[20];}x[5]={1,"ZHAO",2,"QIAN",3,"SUN",4,"LEE",5,"ZHOU"};for(i=1;i
以下程序中函数f的功能是:当flag为1时,进行由小到大排序;当flag为0时,进行由大到小排序。#include<stdio.h>voidf(intb[],intn,intflag){inti,j,t;for(i=0;i<n-1;i+
若有定义语句:doublex[5]={1.0,2.0,3.0,4.0,5.0},*p=x,则错误引用x数组元素的是()。
在数据流图中,带有箭头的线段表示的是()。
设循环队列的存储空间为Q(1:50),初始状态为front=rear=50。现经过一系列入队与退队操作后,front=rear=1,此后又正常地插入了两个元素。最后该队列中的元素个数为
下列不属于软件工程3个要素的是()。
随机试题
小儿于______________时期能伸手取物,扶腋下能站得直。
马,证见发热,肠燥便秘,腹痛,尿短赤,口津干燥,口色深红,舌苔黄厚,脉沉实有力。该病证的治法为()
坏疽性口炎的首选药物为
患者从事每天日常活动即出现心悸、气短症状,休息后即缓解。其心功能分级应为
用户从CA安全认证中心申请自己的证书并将该证书装入浏览器的主要目的是()。
汉字的演变规律概括起来主要表现在()。
一个人能够明辨是非,迅速而合理地采取决定和执行决定方面的意志品质是意志的()。
Theworldisgoingthroughthebiggestwaveofmergersandacquisitionseverwitnessed.TheprocesssweepsfromhyperactiveAmer
(中国矿业大学2015年试题)Oneofthemostfascinatingfieldsofpsychologyismemory.Thispassageisgoingto【C1】______afewthingsab
Cosmeticshavebeenusedthroughouthistory.TheancientCreeks,theEgyptians,andtheRomansallusedvariouskindsofmakeup.
最新回复
(
0
)