单项选择题
以下非法的赋值表达式是
A.n=(i=2,++i);
B.j++;
C.++(i+1);
D.x=j>0;
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
有以下程序 #include<iostream> #include<string> using namespace std; class base private: charbaseName[10]; public: base() strcpy(baseName, Base ); virtual char*myName() return baseName; char *className() return baseName; ; class Derived: public base private: char derivedName[10]; public: Derived() strcpy(derivedName, Derived ); char *myName() return derivedName; char *className() return derivedName; ; void showPtr(base &p) cout<<p.myName0<< <<p.className(); int main() base bb; Derived dd; showPtr(dD) ; retum 0; 动行后的输出结果为
A.Derived Base
B.Base Base
C.Derived Derived
D.Base Derived
点击查看答案&解析
单项选择题
以下程序段共有错误( )处。 #include <iostream> using namespaces std; class Sample private: int n; public: Sample(int i) n=i; void setvalue (int i) n=i; void display() cout<<”n=”<<n<<endl; ; int main() const Sample a(10); a.setvalue(5); a.display(); return 0;
A.1
B.2
C.3
D.4
点击查看答案&解析
相关试题
有如下程序: #inClude<iostream> usi...
有以下程序 #include<iostream> using...
有以下面程序: #include<iostream> u...
已知int DBL(int n)return n+n;和lo...
有以下程序 #include<iostream> using...