重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
找答案首页 > 全部分类 > 求职面试
搜题
网友您好, 请在下方输入框内输入要搜索的题目:
搜题
题目内容 (请给出正确答案)
[主观题]

请写出以下程序的运行结果() #include <iostream> #include <string> using namespace std; void main() { string a, b, c; a = "10"; b = "20"; c = a + b; cout << c << endl; }

查看答案
更多“请写出以下程序的运行结果() #include <iostream> #include <string> using namespace std; void main() { string a, b,…”相关的问题

第1题

下面程序的输出结果是( )。#include<iostream.h> #include<string.h> voidmain() { charp1[10],p2[10]; strcpy(p1,"abc"); strcpy(p2,"ABC"); charstr[50]="xyz": strcpy(str+2,strcat(p1,p2)); cout<<str; }

A.xyzabcABC

B.zabcABC

C.xyabcABC

D.yzabcABC

点击查看答案

第2题

下面程序的输出结果是( )。#include<iostream.h>

#include<string.h>

voidmain()

{

charp1[10],p2[10];

strcpy(p1,"abc");

strcpy(p2,"ABC");

charstr[50]="xyz":

strcpy(str+2,strcat(p1,p2));

cout<<str;

}

A.xyzabcABC

B.zabcABC

C.xyabcABC

D.yzabcABC

点击查看答案

第3题

有以下程序: #include 〈iostream〉 #include 〈string〉 using namespace std; class visited { private: int number; char *name; public: static int glob; void set mes(char *a); }; void visited::set mes(char *a) { name=new char[strlen(A) +1]; strcpy(name,A) ; number=++glob; } int visited::glob-O; int main() { visited person[10]; int i; char str[8]; for(i=0;i<5;i++) { cin>>str; person[i] .set mes(str); } cout<

A.5

B.4

C.3

D.2

点击查看答案

第4题

运行程序,程序运行结果是( )。 #include <iostream> #include &l

< <endl; return> A、s

B、string

C、变量a的地址

D、变量p的地址

</endl;>

点击查看答案

第5题

如下程序定义了“单词”类word,类中重载了<运算符,用于比较“单词”的大小,返回相应的逻辑值。程序的输出结果为:After Sorting:Happy Welcome,请将程序补充完整。

include<iostream>

include<string>

using namespace std;

class Word{

public:

Word(string s):str(s){}

string getStr(){retum str;}

【 】const{retum(str<w.str);}

friend ostream&operator<<(ostream&output,const W0rd&w)

{output<<w.str;return output;}

private:

string str:

};

int main(){

Word wl(”Happy”),w2(“Welcome”);

eout<<”After sorting:”:

if(w1<w2)tout<<wl<<‘ ’<<w2:

else cout<<w2<<‘ ’<<wl:

return 0;

}

点击查看答案

第6题

( 14 )如下程序定义了 “ 单词 ” 类 word ,类中重载了 < 运算符,用于比较 “ 单词 ” 的大小,返回相应

辑值。程序的输出结果为: After Sorting: Happy Welcome ,请将程序补充完整。

#include <iostream>

#include <string>

using namespace std;

class Word {

public:

Word(string s) : str(s) { }

string getStr(){ return str; }

【 14 】 const { return (str<w.str); }

friend ostream& operator << (ostream& output, const Word &w)

{ output<<w.str; return output; }

private:

string str;

};

Int main(){

Word w1("Happy"),w2("Welcome");

Cout<<"After sorting: ";

if(w1<w2) cout<<w1<<' '<<w2;

else cout<<w2<<' '<<w1;

return 0;

}

点击查看答案

第7题

写出下面程序执行后的运行结果。 #include <iostream> #include<string> using namespace std; void main____ { char ch[] = "abc", x[3][4]; int i; for ____ strcpy____; for ____ cout << &x[i][i]; }
点击查看答案

第8题

写出下面程序执行后的运行结果。 #include <iostream> #include <string> using namespace std; char* ss____ { char*p, t; p = s + 1; t = *s; while ____ { *____ = *p; p++; } *____ = t; return s; } void main____
点击查看答案

第9题

写出下面程序执行后的运行结果。 #include <iostream> #include <string> using namespace std; void sort____ { int i, j, k; char*t; for ____ { k = i; for ____ if ____<0) k="j;" if ____ { t="a[i];" a[i]="a[
点击查看答案

第10题

关于下列程序 说法正确的是 #include ...

关于下列程序 说法正确的是 #include <iostream> #include <fstream> #include <string> using namespace std; class A {public: A(const char *na) {strcpy(name,na);} private: char name[80]; }; class B:public A { public: B(const char *nm):A(nm){ } void show(); }; void B::show() { cout<<"name:"<> < <endl; } void main() { b b1("b"); b1.show();> A、能正常执行

B、不能正常执行 只能将第九行private:改为public:才能正常运行

C、不能正常执行 只能将第九行private:改为protected:才能正常运行

D、不能正常执行 B,C两项都行

点击查看答案
下载上学吧APP
客服
TOP
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案
购买前请仔细阅读《购买须知》
请选择支付方式
微信支付
支付宝支付
选择优惠券
优惠券
请选择
点击支付即表示你同意并接受《服务协议》《购买须知》
立即支付
搜题卡使用说明

1. 搜题次数扣减规则:

功能 扣减规则
基础费
(查看答案)
加收费
(AI功能)
文字搜题、查看答案 1/每题 0/每次
语音搜题、查看答案 1/每题 2/每次
单题拍照识别、查看答案 1/每题 2/每次
整页拍照识别、查看答案 1/每题 5/每次

备注:网站、APP、小程序均支持文字搜题、查看答案;语音搜题、单题拍照识别、整页拍照识别仅APP、小程序支持。

2. 使用语音搜索、拍照搜索等AI功能需安装APP(或打开微信小程序)。

3. 搜题卡过期将作废,不支持退款,请在有效期内使用完毕。

请使用微信扫码支付(元)
订单号:
遇到问题请联系在线客服
请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系在线客服
恭喜您,购买搜题卡成功 系统为您生成的账号密码如下:
重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁。
发送账号到微信 保存账号查看答案
怕账号密码记不住?建议关注微信公众号绑定微信,开通微信扫码登录功能
警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

- 微信扫码关注上学吧 -
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反上学吧购买须知被冻结。您可在“上学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
- 微信扫码关注上学吧 -
请用微信扫码测试
选择优惠券
确认选择
谢谢您的反馈

您认为本题答案有误,我们将认真、仔细核查,如果您知道正确答案,欢迎您来纠错

上学吧找答案