牢固树立“()”思想,严格执行本职工作的安全要求,任何时候不可()。
参考答案:安全第一;疏忽大意
使用VC++6.0打开考生文件夹下的源程序文件3.cpp。类People包括姓名和年龄两个字段。函数fun获得年龄比较大的人的姓名,然后输出这个姓名到屏幕。 其中定义的类并不完整,按要求完成下列操作,将类的定义补充完整。 (1)完成类的构造函数功能,请在注释1后添加适当的语句。 (2)完成构造函数对姓名的赋值,请在注释2后添加适当的语句。 (3)定义类的友元函数fun,请在注释3后添加适当的语句。 (4)补充函数fun的年龄比较功能,请在注释4后添加适当的语句。 注意:增加或者修改代码的位置已经用符号表示出来,请不要修改其他的程序代码。 试题程序: #include<iostream.h> class People public: //********1******** int i; for(i=0;sUserName[i]!=0;i++) m_UserName[i]=sUserName[i]; //********2******** m_Old=nOld; private: char m_UserName[32]; int m_Old; //********3******** ; void fun(char *s,People& person1,People&person2) //********4******** if() for(int i=0;person1.m_UserNamd[i]!=0;i++) s[i]=person1.m_UserName[i]; s[i+1]=0; else for(int i=0;person2.m_UserName[i]!=0;i++) s[i]=person2.m_UserName[i]; s[i+1]=0; void main() char s[32]; People p1("abc",20); People p2("def",30); fun(s,p1,p2); cout<<s<<end1; return;
下面程序的输出结果是( )。 #include <iostream> using namespace Std; int main() {int x[6]={1,3,5,7,9,11},*k,**s;k=x;s=&k;cout<<*(k++)<< “,”<<**s<<end1;return 0; }
A.3,3
B.1,1
C.3,5
D.3,1