下面程序的输出结果是()。 #include<iostream> Usingnamespacestd; ClassBase{ public:
A.0
B.1
C.01
D.001
A.0
B.1
C.01
D.001
A、8
B、9
C、10
D、11
A、7和5
B、7
C、6
D、6和4
include<iostream.h>
void funl(char a,char b)
{
char c;
c=a;a=b;b=C;
}
void fun2(char &a,char b)
{
char c;
c=a;a=b;b=c;
}
void fun3(char &a,char &b)
{
char c;
c=a;a=b;b=C;
}
void main()
{
char a,b;
a='A';b='B';
funl(a,b);cout<<a<<b;
a='A';b='B';
fun2(a,b);cout<<a<<b;
a='A';b='B';
fun3(a,b);cout<<a<<b;
}
则该程序的输出为【 】。
[说明]
下面程序输出一个矩形面积,以及矩形区域上的假想的作物产量。
[C++程序]
include <iostream.h>
class crop_assessment
{
int actual_crop;
int ideal_crop;
public:
void set(int in_actual,int in_ideal)
{
actual crop=in_actual;
ideal_crop=in_ideal;
}
int get_actual_crop(void){ (1) ;}
int get_ideal_crop(void){ (2) ;)
};
Class lot_size
{
int length;
int width;
(3) crop;
public:
void set(int 1,int w,int a,int i)
{
length=1;
width=w;
crop.set(a,i);
}
int get_area(void){return length*width;}
int get_data(void){return (4) ;}
int get_data2(void)freturn (5) ;}
}
int main()
{
Los_size small,medium;
small.set(5,5,5,25);
medium.set(10,10,10,50);
cout<<"For a small lot of area"<<smallget_area()<<“\n”;
cout<<"the actual crops are$"<<small.get_data2()<<"\n";
cout<<"and ideal crops are$”<<small.get_data()<<"\n";
cout<<"For a medium Lot of area"<<medium.get area()<<:\n”;
cout<<"the actual crops are$"<<medium.get_data2()<<"\n";
cout<<"and ideal crops are$"<<medium.get_data()<<"\n";
return 0;
}
A、Shape *s;
B、void function(Shape *s);
C、void function(Shape& s);
D、Shape s;
A、派生类的对象可以隐含转换为基类对象
B、派生类对象可以初始化基类的引用
C、派生类的指针可以用来调用派生类的成员函数
D、派生类的指针可以隐含转换为基类的指针
A、friend float operator + (float);
B、friend Point operator + (float x, float y);
C、friend Point operator + (float, float);
D、friend Point & operator + (Point, float);
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!