有如下程序:
Private type stu
X as string
Y as integer
End type
Private Sub Command1_Click()
Dim a as stu
a.x=”ABCD”
a.Y=12345
print a
End Sub
程序运行时出现错误,错误的原因是
A)Type定义语句没有放在标准模块中
B)变量声明语句有错
C)赋值语句不对
D)输出语句print不对
第1题:
有以下程序: #include<iostrearn> using namespace std; class sample { private: int x; static int y; public: sample (int A) ; static void print (sample s); }; sample::sample(int A) { x=a; y+=x; }
A.x=10,y=20
B.x=20,y=30
C.x=30,y=20
D.x=30,y=30
第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题:
有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int b) { x=a; y=b; } int getx() { return x; }
A.314
B.157
C.78.5
D.153.86
第4题:
有如下程序:#include <iostream>using namespace std;class Base{private: char c;public: Base(char n) :c(n){} ~Base() { cout<<c; } };class Derived: public Base{private: char c; public: Derived(char n):Base(n+1),c(n) {} ~Derived() { cout<<c; }};int main (){ Derived obj ('x'); return 0;}执行上面的程序净输出
A.xy
B.yx
C.x
D.y
第5题:
有下列程序: #include<iostream> using namespace std; class TestClass { private: int x,y; public: TestClass (int i,int j) { x=i; y=j; } void print() { cout<<"printl"<<endl; } vo
A.print1
B.print2
C.pfint1 print2
D.程序编译时出错
第6题:
有如下程序:#include <iostream>using namespace std;class Base{private: char c;public: Base(char n):c(n){} ~Base() { cout<<c; }};class Derived: public Base{private: char c;public: Derived(char n):Base(n+1),c(n){} ~Derived() { cout<<c; }};int main(){ Derived obj('x'); return 0; }执行上面的程序将输出( )。
A.xy
B.yx
C.x
D.y