下面的程序是找出50以内所有能构成直角三角形的整数组。阅读下面程序,并完成程序。
Private Sub Command1_Click( )
For a = 1 to 50
For b = a to 50
c = Sqr(a^ 2 + b^ 2)
If【 】then print a; b; c
next b
next a
end Sub
第1题:
【其它】程序分析: 阅读下面的程序,分析代码是否能够编译通过,如果能编译通过,请列出运行的结果。否则请说明编译失败的原因。 public class Test { int x = 50; static int y =200 ; public static void method() { System.out.println(x+y); } public static void main(String[] args) { Test2.method(); } }
第2题:
阅读下面的程序: list = [] list[0] 上述程序会产生()异常。
A.ZeroDivisionError
B.SyntaxError
C.IndexError
D.KeyError
第3题:
为完成下面的程序,应在划线处填入的语句是( )。 #include <iostream> using namespace std; class Base { private: int x; public: Base(int i) { x=i; } ~Base(){} }; class Derived : public Base { public: _______________ //完成类Derive构造函数的定义 }; int main() { Derived Obj; return 0; }
A.Derived(int i):Base(i){}
B.Derived(){}
C.voidDerived(int i):Base(0){}
D.Derived(int i){Base(i);}
第4题:
阅读下面程序:
include <iostream.h>
template <class T>
class TAdd
{
private:
T x, y;
public:
TAdd(T a, T b)
{
x=a;
y=b;
}
T add()
{
return x +y;
}
};
void main( )
{
TAdd<int>a(5,6);
TAdd<double>b(2.4,5.8);
cout<<"s1 ="<<A. add()<<",";
cout<<"s2="<<B, add()<<end1;
}
写出该程序的运行结果:【 】。
第5题:
下面这个程序的结果是 #include<iostream.h> class A { private: int a; public: void seta( );int geta( );}; void A::seta( ) { a = 1;} int A::geta( ) {return a;} class
A.1
B.2
C.随机输出1或2
D.程序有错
第6题:
根据下面的主程序,完成类的一种构造函数的最简单形式。
include<iostream.h>
class base
{
private:
int num;
public:
______;
};
void main( )
{
base try(6);
}
第7题:
为完成下面的程序,应在划线处填入的语句是 #include<iostream> using namespace std; class Base { private: int x; public: Base (int i) { x=i; } ~Base(){} }; class Derived:public Base { public: ______________//完成类Derive构造函数的定义 }; int main() { Derived Obj; return 0; }
A.Derived(int i):Base(i){}
B.Derived(){}
C.void Derived (int i):Base(i){}
D.Derived(int i){Base(i);}
第8题:
以下程序找出50以内所有能构成直角三角形的整数组。阅读下列程序,并完成程序。
Private Sub Command1_Click()
For a=1 to 50
For b=a to 50
c=Sqr(a^2+b^2)
If 【 】 then print a;b;c
Next b
Next a
end Sub
c<=50 And c=Int(c)
第9题:
一下程序找出50以内所有能构成直角三角形的整数组。阅读下列程序,并完成程序。
Private Sub Command1_Click()
For a=1 to 50
For b=a to 50
c=Sqr(a^2+b^2)
If【 】then print a;b;c
next b
next a
end Sub
c<=50 And c=Int?