填空题
若有如下程序段:
#include <iostream>
using namespace std;
int main()
char *p="abcdefgh",*r;
long *q;
q=(long *)p;q++;
r=(char *)q;
cout<<r<<end1;
return 0;
该程序的输出结果是______。
【参考答案】
efgh
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
在下面程序的横线处填上适当的内容,使程序执行后的输出结果为1 2005。 #include <iostream.h> using namespace std: class Date public: Date (int m=1,int y=0):month(m .year(y void Print() cout<<month<< <<year<<end1; ______operator+(const Date& d1,const Date&d2; private: int month year; ; ______operaror+(const Date&d1,const Date& d2) int year, month; year=d1.year+d2.year; month=d1.month+d2.month; year+=(month-1) 12; month=(month-1)%12+l; return Datemonth, year: void main() Date d1(3,2004),d2,d3(10); d2=d3+d1; d2.Print();
点击查看答案&解析
单项选择题
有以下程序: #include <iostream> using namespace std; class sample private: int n: public: sample () sample(int m) n=m; sample add(sample s1, sample s2) this->n=s1.n+s2.n; return (*this); void disp () cout << n= <<n<<end1; ; int main() sample s1(1)0,s2(5),s3; s3.add(s1,s2); s3.disp(); return 0; 程序运行后,输出的结果是
A.n=10
B.n=5
C.n=20
D.n=15
点击查看答案&解析
相关试题
与成员访问表达式p->name等价的表达式是...
有如下程序: #include <iostream> u...
下列函数的功能是判断字符串str是否对称,...
在数据库的概念结构设计中,常用的描述工具...
在下面程序的横线处填上适当的内容,使程序...