以下程序段共有错误( )处。 #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 using namespaces std;class A{public: A (){} A (int i) {x1=若有以下程序: #include <iostream> using namespaces std; class A { public: A (){} A (int i) { x1=i; } void dispa() { cout<<"xl="<<xl<<" , "; } private: int x1; }; class B : public
[单选题]若有以下程序:include using namespaces std;class A {public: A(){} A(int i) {x1=i若有以下程序: #include <iostream> using namespaces std; class A { public: A(){} A(int i) { x1=i; } void dispa() { cout<<'x1="<<x1<<","; } private: int x1; }; class B: public A { p
[单选题]若有如下程序:include using namespaces std;int s=0;class sample {static iht n;pu若有如下程序: #include <iostream> using namespaces std; int s=0; class sample { static iht n; public: sample(int i) { n=i; } static void add() { s+=n; } }; int sample::s=0; int main()
[单选题]有以下程序include include using namespace std;class base{private:char有以下程序 #include <iostream> #include <string> using namespace std; class base { private: char baseName[10]; public: base () { strcpy(baseName,"Base"); } virtual char *myName() { return b
[单选题]有以下程序:include using namespace std;int s=0;class sample{ static int n;publi有以下程序: #include <iostream> using namespace std; int s=0; class sample { static int n; public: sample (int i) { n=i; } static void add() { s+=n; } }; int sample::n=0;A.2B.5C.7D.
[试题]若有以下程序段: include using namespace std; int main() {char*p="abcdefgh",*r;l若有以下程序段: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;}该程序的输出结果是[ ]。
[单选题]有如下程序include include using namespace std;class MyClass {public:M有如下程序#include <iostream>#include <iomanip>using namespace std; class MyClass {public:MyClass(){ cout<<'A'; }MyClass(char c){ cout<<c; }~MyClass(){ cout<<'B'; }};int main() {MyClass p
[单选题]有如下程序include include using namespace std;int main( ){cout<
[单选题]有以下程序:include include using namespace std;int main ( ){ char b1[8有以下程序: #include <iostream> #include <string> using namespace std; int main ( ) { char b1[8] = "abcdefg"; char b2[8],*pb=b1+3; while (--pb>=b1) strcpy (b2, Pb) ; cout<<strlen (b2) <<en
[单选题]有以下程序:include include using namespace std;class point{private: doub有以下程序: #include <iostream> #include <math> using namespace std; class point { private: double x; double y; public: point(double a,double b) { x=a; y=b; } friend double distance(point