题目内容 (请给出正确答案)
[主观题]

include<iostream>include<string>using namespace std;class MyClass{public: MyCl

include<iostream>

include<string>

using namespace std;

class MyClass

{

public:

MyClass(int i=0){member=i;}

void SetMember(const string m){member="big"+m;m=member;}

string GetMember(){return member;}

void print()const{cout<<"Stu:"<<member<<endl;}

private:

string member;

};

void main()

{

MyClass obj1,*obj2;

string i="wang lin";

obj2=&obj1;

obj2->SetMember(i);

obj1.print();

}

提问人:网友wind00123 发布时间:2022-01-07
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
更多“include<iostream>include<strin…”相关的问题
第1题
有以下程序: #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$amp;>amp;$gt;str; person[i] .set mes(str); } cout$amp;A.5;$br>

B.4

C.3

D.2

点击查看答案
第2题

有以下程序: #include <iostream> #include <string> using namespace std; class Y; class X { private: int x; char *strx; public: X(int a, char *str) { x=a; strx=new char[strlen(str)+1]; strcpy(strx,str); } void show(Y &ob) ; }; class Y { private: int y; char *stry; public: Y(int b,char *str) { y=b; stry=new char[strlen(str)+1]; strcpy(stry, str); } friend void X: :show(Y &ob) ; }; void X: :show(Y &ob) { cout<<strx<<", "; cout<<ob, stry<<end1; } int main () { X a(10,"X"); Y b (20, "Y"); a. show(B) ; return 0; } 执行后的输出结果是()。

A.X,Y

B.a,b

C.X,X

D.Y,Y

点击查看答案
第3题
编写函数,接收一个字符串,分别统计大写字母、小写字母、数字、其他字符的个数,以元组的形式返回结果,最后调用这个函数并传递参数,输出函数的返回结果。要求不是大写字母、小写字母、数字的任意字符都记入其他字符的个数。
点击查看答案
第4题
请编写函数con(char s1[ ], char s2[ ]),其功能是实现两个字符串的连接(不能使用库函数strcat), 即把字符数组s2中的字符串连接到字符数组s1字符串的后面。 例如main函数中输入"hello",“world”,则最后输出``“helloworld” ;
点击查看答案
第5题
定义compare(char *s1, char *s2)函数,以实现比较两个字符串大小的功能。 以下程序运行结果为-32,选择正确答案填空: #include <stdio.h> int compare(char *s1, char *s2); void main() { printf("%d\n", compare("abCd", "abc")); } int compare(char *s1, char *s2) { while(*s1&&*s2&&_____) { s1++; s2++; } return *s1-*s2; }

A、*s1!=*s2

B、*s1==*s2

C、*s1=*s2

D、s1!=s2

点击查看答案
第6题
下面代码运行后的输出结果为( )。 public class X6_1_5 { public static void main(String[] args) { AB aa = new AB(); AB bb; bb = aa; System.out.println(bb.equals(aA.); } } class AB{ int x = 100; } A.true B.false C.编译错误 D.100

A、true

B、false

C、编译错误

D、100

点击查看答案
第7题
有以下程序: #include <iostream> #include <string> usxng namespace std; int main() { char p[] = "abcdefgh"; cout<<strlen(strcpy(p,"12345"))<<end1; return 0; } 执行后输出的结果是()。

A.8

B.12

C.5

D.7

点击查看答案
第8题
有如下程序: #include <iostream> #include <string> using namespace std; class XCF { int a; public: XCF (int aa=0) : a(aa) { cout<<"1"; } xcf(xcf & x) { a="x.a;" ~xcf( ) int geta( return a; }; void main( xcf d1(5),d2(d1); *pd="new" xcf(8);> Geta( ); delete pd; } 运行时的输出结果是

A、1218855

B、1215588

C、12185

D、128512

点击查看答案
第9题
#include <iostream> using namespace std; class Test{ private: int x1=2; //私有 public: int x2=3; //共有 }; int main() { Test test; cout<<test.x1<<endl; } 哪一条语句是错误的>
点击查看答案
账号:
你好,尊敬的用户
复制账号
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
欢迎分享答案

为鼓励登录用户提交答案,简答题每个月将会抽取一批参与作答的用户给予奖励,具体奖励活动请关注官方微信公众号:简答题

简答题官方微信公众号

警告:系统检测到您的账号存在安全风险

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

微信搜一搜
简答题
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
简答题
点击打开微信