以下程序的输出结果是()。 Dim a%() = { 1, 2, 3, 4, 5, 6, 7 }, i% For i = 0 To a.GetUpperBound(0) a(i) = a(i) * a(i) Next MsgBox(a(i) )
A.49
B.0
C.不确定
D.程序出错
A.49
B.0
C.不确定
D.程序出错
[说明]
以下程序的功能时三角形、矩形和正方形的面积输出。
程序由5个类组成:areatest是主类,类Triangle,Rectangle和Square分别表示三角形、矩形和正方形,抽象类Figure提供了一个计算面积的抽象方法。
[Java程序]
public class areatest {
public static viod main(string args[]){
Figure[]Figures={
New triangle(2,3,3),new rectangle(5,8),new square(5)
};
for(int i=0; i<Figures.length;i++){
system.out.println(Figures+"area="+Figures.getarea());
}
}
}
public abstract class figure {
public abstract double getarea();
}
public class rectangle extends (1) {
double height;
double width;
public rectangle (double height,double width){
this.height=height;
this.width=width;
}
public string tostring(){
return"rectangle:height="+height+",width="+width+":";
}
public double getarea(){
return (2)
}
}
public class square exends (3)
{
public square(double width){
(4);
}
public string tostring(){
return"square:width="+width":";
}
}
public class triangle entends (5)
{
double la;
double lb;
double lc;
public triangle(double la,double lb,double lc){
this.la=la;this.lb=lb;this.lc=lc;
}
public string tostring()(
return"triangle:sides="+la+","+lb+","+lc+":";
}
public double get area(){
double s=(la+lb+lc)/2.0;
return math.sqrt(s*(s-la)*(s-lb)*(s-lc));
}
}
阅读以下说明和C++程序,将应填入(n)处的语句写在答题纸的对应栏内。
【说明】
以下程序的功能是计算三角形、矩形和正方形的面积并输出。
程序由4个类组成:类Triangle、Rectangle和Square分别表示三角形、矩形和正方形;抽象类Figure提供了一个纯虚拟函数getArea(),作为计算上述3种图形面积的通用接口
【C++程序】
#include
#include
class Figure{
public:
virtual double getArea()=0:∥纯虚拟函数
};
class Rectangle: (1) {
protected:
double height;
double width;
public:
Rectangle(){};
Rectangle(double height,double width){
this->height=height;
this->width=width;
}
double getArea(){
return (2) ;
}
};
class Square: (3) {
public:
Square(double width){
(4) ;
}
};
class Triangle: (5) {
double la;
double Ib;
double lc;
public:
Triangle(double la,double lb,double lc){
This->la=la;this->lb=lb;this->lc=lc;
}
double getArea(){
double s=(la+lb+±c)/2.0;
return sqrt(s*(s-1a)*(s-1b)*(s-1c));
}
};
void main(){
Figure*figures[3]={
new Triangle(2,3,3),new Rectangle(5,8),new SqUare (5) );
for (int i=0;i<3;i++){
cout$amp;}
}
My Love, My Umbrella (excerpt) by John McGahern It was the rain, the constant weather of this city, made my love inseparable from the umbrella, a black umbrella, white stitching on the seams of the imitation leather over the handle, the metal point bent where it was caught in Mooney's grating as we raced for the last bus to the garage out of Abbey Street. The band was playing when we met, the Blanchardstown Fife and Drum. They were playing Some day he'll come along/The man I love/And he'll be big and strong/The man I love at the back of the public lavatory on Burgh Quay, facing a few persons on the pavement in front of the Scotch House. It was the afternoon of a Sunday. 'It is strange, the band,' I said; her face flinched away, and in the same movement back, turned to see who'd spoken. Her skin under the black hair had the glow of health and youth, and the solidity at the bones of the hips gave promise of a rich seed-bed. 'It's strange,' she answered, and I was at once anxious for her body. The conductor stood on a wooden box, continually breaking off his conducting to engage in some running argument with a small grey man by his side, but whether he waved his stick jerkily or was bent in argument seemed to make no difference to the players. They turned their pages. The music plodded on, Some day he'll come along/The man I love/And he'll be big and strong/The man I love. At every interval they looked towards the clock, Mooney's clock across the river. 'They're watching the clock,' I said. 'Why?' her face turned again. 'They'll only play till the opening hour.' I too anxiously watched the clock. I was afraid she'd go when the band stopped. Lights came on inside the Scotch House. The music hurried. A white-aproned barman, a jangle of keys into the quickened music, began to unlock the folding shutters and with a resounding clash drew them back. As the tune ended the conductor signalled to the band that they could put away their instruments, got down from his box, and started to tap the small grey man on the shoulder with the baton as he began to argue in earnest. The band came across the road towards the lighted globes inside the Scotch House, where already many of their audience waited impatiently on the slow pulling of the pints. The small grey man carried the conductor's box as they passed in together. 'It is what we said would happen.' 'Yes.' The small family cars were making their careful way home across the bridge after their Sunday outings to their cold ham and tomato and lettuce, the wind blowing from the mouth of the river, gulls screeching above the stink of its low tide, as I forced the inanities towards an invitation. 'Would you come with me for a drink?' 'Why?' She blushed as she looked me full in the face. 'Why not?' 'I said I'd be back for tea.' 'We can have sandwiches.' 'But why do you want me to?' 'I'd like very much if you come. Will you come?' 'All right I'll come but I don't know why.' It was how we began, the wind blowing from the mouth of the river while the Blanchardstown Fife and Drum downed their first thirst-quencher in the Scotch House.
A、滚动条的GotFocus事件过程
B、滚动条的Scroll事件过程
C、文本框的KeyPress事件过程
D、文本框的TextChanged事件过程
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!