四、完成程序题(本大题共5小题,每小题4分,共20分)
46.将下面程序补充完整,使程序输出结果为:
Begin
Welcome
Show
End
程序如下:
#include
using namespace std;
class A{
public:
__________{
cout <<″Begin″<
void show( ){
cout<<″Show″<
___________{
cout<<″End″<
};
A object;
int main( ){
cout <<″Welcome″<
return 0;
}
47.请将下面程序补充完整,使程序可以正常打印9×9乘法口诀。
#include
using namespace std;
class A {
private:
int a;int b;
public:
__________
{ a = x;b = y; }
void set(int x,int y)
{ a = x;b = y; }
void display( ){
cout<}
};
int main( ){
A a(1,1);
for(int i=1;i<=9;i++){
for(int j=1;____;j++){
a.set(j,i);
a.display( );
cout<<″″;
}
cout<
return 0;
}