Private Sub numCount()
Dim hum As Integer
s$ = "software And hardware"
num = Len(s$)
For i = 1 To hum
b$=______
If b$ = "a" Then x = x+1
Next i
Print "x="; x
End Sub
【说明】
本程序的功能是根据矩形左上角和右下角顶点坐标生成一个矩形对象,然后输出该矩形4个顶点的坐标,计算并输出该矩形的面积。
【C++代码】
include<iostream>
using namespace std;
class MyPoint(//表示平面坐标系中的点的类
double x;
double y;
public:
MyPoint (double x,double y){this->x=x;this->y=y;}
double getX()const{(1);}
double getY()const{ return y;}
void show()const{ cout<<'('<<x<<','<<y<<')';}
};
class MyRectangle{ //表示矩形的类
MyPoint upleft; //矩形的左上角顶点
MyPoint down right; //矩形的右下角顶点
public:
MyRectangle(MyPoint upleft,MyPoint downright);
MyPoint getUpLeft()const{return up_left;} //返回左上角坐标
MyPoint getDownRight()const{return down_right;} //返回右下角坐标
MyPoint getUpRight()const; //返回右上角坐标
MyPoint getDownLeft()const; //返回左下角坐标
double area()const; //返回矩形的面积
};
MyRectangle:: MyRectangle((2)):
up left(p1),down_right(p2){}
MyPoint MyRectangle::getUpRight()const
{
return MyPoint(down_right.getX(),up_left.getY());
}
MyPoint MyRectangle::getDownLeft()const
{
return MyPeint((3));
}
double (4) ::area()const
{
return (getUpLeft(),getX()-getDownRight().getX())*
(getDownRight().getY()-getUpLeft().getY());
}
int main()
{
MyRectangle r(MyPoint(0,2),MyPoint(2,0));
r.getUpLeft(),show();
r.getUpRight().show();
r.getDown Right().show();
(5);
cout<<r.area()<<end1;
return 0;
}
A、第19行代码: else if(m < 0) 第22行代码: if (m % 2 == 0)
B、第19行代码: if(m < 0) 第22行代码: if (m % 2 == 0)
C、第19行代码: else if(m < 0) 第22行代码: if (m % 2 != 0)
D、第19行代码: if(m < 0) 第22行代码: if (m % 2 != 0)
public class ThreadTest
{
public static void main(String args [])
{
Thread testObj1 = new Thread (new Hello ());
Thread testObj2 = new Thread (new Hello ());
testObj 2.start ();
}
}
class Hello implements Runnable
{
int j;
public void run()
{
System.out.println("Hello" + j ++);
}
}
【说明】
下面程序的功能是显示已定义的一个3行3列的二维数组每行的元素,并求所有元素的和并输出。请在程序的每条横线处填写一个适当的语句,使程序的功能完整。
public class Arrayt
(1) static (2) main(String args[])
{
int sum=0;
int [][] = t {11,12,13}, {21,22,23},{31,32,33}};
for(int i=0; (3) i++)
{
System. out. print("b["+i+"]:");
for(int j=0;(4) j++)
System. out. print(b[i] [j] +" ");
(5)
}
System. out. println ();
}
System. out. println("sum="+sum);
}
}
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!