C++程序填空题三道 100
填程序题1.Thefollowingprogramusestaticdatamemberobj_counttocountthetotalnumberoftheobject...
填程序题
1. The following program use static data member obj_count to count the total number of the objects that have been created, please fill in the blanks.
#include<iostream>
___________________
class CL
{ static int obj_count;
int x;
___________________
CL() { obj_count++;}
CL(int i){ x=i; obj_count++;}
~CL() { obj_count--; }
static int get_num()
{ return obj_count; }
};
____________________
void main()
{ CL a1;
CL a2(10);
CL a3[10];
cout<<CL::get_num()<<endl;
}
2.The following program use array to sort the 10 numbers that input from the keyboard by ascending(升序),please fill in the blanks.
#include<iostream>
using namespace std;
void main()
{
int a[10],i,j,temp;
for(i=0;i<=9;i++)
_____________
for(i=0;i<10;i++)
for(j=0;j<10-i-1;j++)
________________
{ temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
for(i=0;i<=9;i++)
cout<<a[i]<<endl;
}
3.class A{
int i;
public:
A(int ii){
_____________;
cout<<”The constructor is called”<<endl;
}
A(_____________){
Cout<<”the copy constructor is called”<<endl;
}
~A(){
cout<<”The destructor is called”
}
};
void main(){
A a(3);
A b=a;
}
请给出具体答案,并说明填空的原理和考点,最好给出一些例子,说明越明白详细,越好。谢谢。 展开
1. The following program use static data member obj_count to count the total number of the objects that have been created, please fill in the blanks.
#include<iostream>
___________________
class CL
{ static int obj_count;
int x;
___________________
CL() { obj_count++;}
CL(int i){ x=i; obj_count++;}
~CL() { obj_count--; }
static int get_num()
{ return obj_count; }
};
____________________
void main()
{ CL a1;
CL a2(10);
CL a3[10];
cout<<CL::get_num()<<endl;
}
2.The following program use array to sort the 10 numbers that input from the keyboard by ascending(升序),please fill in the blanks.
#include<iostream>
using namespace std;
void main()
{
int a[10],i,j,temp;
for(i=0;i<=9;i++)
_____________
for(i=0;i<10;i++)
for(j=0;j<10-i-1;j++)
________________
{ temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
for(i=0;i<=9;i++)
cout<<a[i]<<endl;
}
3.class A{
int i;
public:
A(int ii){
_____________;
cout<<”The constructor is called”<<endl;
}
A(_____________){
Cout<<”the copy constructor is called”<<endl;
}
~A(){
cout<<”The destructor is called”
}
};
void main(){
A a(3);
A b=a;
}
请给出具体答案,并说明填空的原理和考点,最好给出一些例子,说明越明白详细,越好。谢谢。 展开
2009-01-02
展开全部
很讨厌“越详细越好”,那样的话,你根本就不应该来问,而是应该好好看书的。
1. The following program use static data member obj_count to count the total number of the objects that have been created, please fill in the blanks.
#include<iostream>
using namespace std;//命名空间____________________
class CL
{ static int obj_count;
int x;
public://成员函数共有___________________
CL() { obj_count++;}
CL(int i){ x=i; obj_count++;}
~CL() { obj_count--; }
static int get_num()
{ return obj_count; }
};
int CL::obj_count=0; //初始化____________________
void main()
{ CL a1;
CL a2(10);
CL a3[10];
cout<<CL::get_num()<<endl;
}
2.The following program use array to sort the 10 numbers that input from the keyboard by ascending(升序),please fill in the blanks.
#include<iostream>
using namespace std;
void main()
{
int a[10],i,j,temp;
for(i=0;i<=9;i++)
cin>>a[i];//输入数据_____________
for(i=0;i<10;i++)
for(j=0;j<10-i-1;j++)
if(a[j]<a[j+1]//如果数组前者小于后面的一个________________
{ temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
for(i=0;i<=9;i++)
cout<<a[i]<<endl;
}
3.class A{
int i;
public:
A(int ii){
i=ii;//构造函数_____________;
cout<<”The constructor is called”<<endl;
}
A(A &_____________){
Cout<<”the copy constructor is called”<<endl;
}
~A(){
cout<<”The destructor is called”
}
};
void main(){
A a(3);
A b=a;
}
1. The following program use static data member obj_count to count the total number of the objects that have been created, please fill in the blanks.
#include<iostream>
using namespace std;//命名空间____________________
class CL
{ static int obj_count;
int x;
public://成员函数共有___________________
CL() { obj_count++;}
CL(int i){ x=i; obj_count++;}
~CL() { obj_count--; }
static int get_num()
{ return obj_count; }
};
int CL::obj_count=0; //初始化____________________
void main()
{ CL a1;
CL a2(10);
CL a3[10];
cout<<CL::get_num()<<endl;
}
2.The following program use array to sort the 10 numbers that input from the keyboard by ascending(升序),please fill in the blanks.
#include<iostream>
using namespace std;
void main()
{
int a[10],i,j,temp;
for(i=0;i<=9;i++)
cin>>a[i];//输入数据_____________
for(i=0;i<10;i++)
for(j=0;j<10-i-1;j++)
if(a[j]<a[j+1]//如果数组前者小于后面的一个________________
{ temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
for(i=0;i<=9;i++)
cout<<a[i]<<endl;
}
3.class A{
int i;
public:
A(int ii){
i=ii;//构造函数_____________;
cout<<”The constructor is called”<<endl;
}
A(A &_____________){
Cout<<”the copy constructor is called”<<endl;
}
~A(){
cout<<”The destructor is called”
}
};
void main(){
A a(3);
A b=a;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
填程序题
1. The following program use static data member obj_count to count the total number of the objects that have been created, please fill in the blanks.
#include<iostream>
using namespace std;//命名空间____________________
class CL
{ static int obj_count;
int x;
public://成员函数共有___________________
CL() { obj_count++;}
CL(int i){ x=i; obj_count++;}
~CL() { obj_count--; }
static int get_num()
{ return obj_count; }
};
int CL::obj_count=0; //初始化____________________
void main()
{ CL a1;
CL a2(10);
CL a3[10];
cout<<CL::get_num()<<endl;
}
2.The following program use array to sort the 10 numbers that input from the keyboard by ascending(升序),please fill in the blanks.
#include<iostream>
using namespace std;
void main()
{
int a[10],i,j,temp;
for(i=0;i<=9;i++)
cin>>a[i];//输入数据_____________
for(i=0;i<10;i++)
for(j=0;j<10-i-1;j++)
if(a[j]<a[j+1]//如果数组前者小于后面的一个________________
{ temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
for(i=0;i<=9;i++)
cout<<a[i]<<endl;
}
3.class A{
int i;
public:
A(int ii){
i=ii;//构造函数_____________;
cout<<”The constructor is called”<<endl;
}
A(A &_____________){
Cout<<”the copy constructor is called”<<endl;
}
~A(){
cout<<”The destructor is called”
}
};
void main(){
A a(3);
A b=a;
}
1. The following program use static data member obj_count to count the total number of the objects that have been created, please fill in the blanks.
#include<iostream>
using namespace std;//命名空间____________________
class CL
{ static int obj_count;
int x;
public://成员函数共有___________________
CL() { obj_count++;}
CL(int i){ x=i; obj_count++;}
~CL() { obj_count--; }
static int get_num()
{ return obj_count; }
};
int CL::obj_count=0; //初始化____________________
void main()
{ CL a1;
CL a2(10);
CL a3[10];
cout<<CL::get_num()<<endl;
}
2.The following program use array to sort the 10 numbers that input from the keyboard by ascending(升序),please fill in the blanks.
#include<iostream>
using namespace std;
void main()
{
int a[10],i,j,temp;
for(i=0;i<=9;i++)
cin>>a[i];//输入数据_____________
for(i=0;i<10;i++)
for(j=0;j<10-i-1;j++)
if(a[j]<a[j+1]//如果数组前者小于后面的一个________________
{ temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
for(i=0;i<=9;i++)
cout<<a[i]<<endl;
}
3.class A{
int i;
public:
A(int ii){
i=ii;//构造函数_____________;
cout<<”The constructor is called”<<endl;
}
A(A &_____________){
Cout<<”the copy constructor is called”<<endl;
}
~A(){
cout<<”The destructor is called”
}
};
void main(){
A a(3);
A b=a;
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
1. The following program use static data member obj_count to count the total number of the objects that have been created, please fill in the blanks.
#include<iostream>
__using namespace std;//预处理空间。_________________
class CL
{ static int obj_count;
int x;
___public://共有成员。________________
CL() { obj_count++;}
CL(int i){ x=i; obj_count++;}
~CL() { obj_count--; }
static int get_num()
{ return obj_count; }
};
__#include"iostream.h"//自定义头文件__________________
void main()
{ CL a1;
CL a2(10);
CL a3[10];
cout<<CL::get_num()<<endl;
}
2.The following program use array to sort the 10 numbers that input from the keyboard by ascending(升序),please fill in the blanks.
#include<iostream>
using namespace std;
void main()
{
int a[10],i,j,temp;
for(i=0;i<=9;i++)
______cin>>a[i];//输入数组元素。_______
for(i=0;i<10;i++)
for(j=0;j<10-i-1;j++)
__if(a[j]>a[j+1])//对元素进行比较。______________
{ temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
for(i=0;i<=9;i++)
cout<<a[i]<<endl;
}
3.class A{
int i;
public:
A(int ii){
____i=ii;//进行初始化。_________;
cout<<”The constructor is called”<<endl;
}
A(_____const A&________)//复制的构造函数。{
Cout<<”the copy constructor is called”<<endl;
}
~A(){
cout<<”The destructor is called”
}
};
void main(){
A a(3);
A b=a;
}
#include<iostream>
__using namespace std;//预处理空间。_________________
class CL
{ static int obj_count;
int x;
___public://共有成员。________________
CL() { obj_count++;}
CL(int i){ x=i; obj_count++;}
~CL() { obj_count--; }
static int get_num()
{ return obj_count; }
};
__#include"iostream.h"//自定义头文件__________________
void main()
{ CL a1;
CL a2(10);
CL a3[10];
cout<<CL::get_num()<<endl;
}
2.The following program use array to sort the 10 numbers that input from the keyboard by ascending(升序),please fill in the blanks.
#include<iostream>
using namespace std;
void main()
{
int a[10],i,j,temp;
for(i=0;i<=9;i++)
______cin>>a[i];//输入数组元素。_______
for(i=0;i<10;i++)
for(j=0;j<10-i-1;j++)
__if(a[j]>a[j+1])//对元素进行比较。______________
{ temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
for(i=0;i<=9;i++)
cout<<a[i]<<endl;
}
3.class A{
int i;
public:
A(int ii){
____i=ii;//进行初始化。_________;
cout<<”The constructor is called”<<endl;
}
A(_____const A&________)//复制的构造函数。{
Cout<<”the copy constructor is called”<<endl;
}
~A(){
cout<<”The destructor is called”
}
};
void main(){
A a(3);
A b=a;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
using namespace std;
public:
int CL::obj_count=0;
cin>>a[i];
if(a[i]>a[j])
i=ii;
(A &P)
考点是最基础的C++的理论,仔细看下入门书籍大概就能了解
public:
int CL::obj_count=0;
cin>>a[i];
if(a[i]>a[j])
i=ii;
(A &P)
考点是最基础的C++的理论,仔细看下入门书籍大概就能了解
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
天天开心。好好学习
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询