更多"有如下的程序; #include <ctring> #includ"的相关试题:
[单项选择]有如下程序:
#include <iostream>
#include <iomarup>
using namespace std;
int main( )
cout<<setw(10)<<setfill('x')<<setprecision(8)<<left;
cout<<12.3456793<<______<<98765;
return 0;
若程厚的输出是12.345679x98765xxxxx,则划线处缺失的部分是( )。
[单项选择]有如下程序:
#include <iostream>
#include <iomanip>
using namespace std;
int main( )
cout.fill('*');
cout.width(6);
cout.fill('#');
cout<<123<<endl;
return 0;
执行后的输出结果是( )。
A. ###123
B. 123###
C. ***123
D. 123***
[单项选择]有以下程序: #include<iostream> #include<string> using namespace std; int main( ) { char arr[2][4]; strcpy(arr[0],"you"); strcpy(arr[1],"me"); arr[0][3]=’&’; cout<<arr[0]<<end1; return 0; } 执行后的输出结果是( )。
A. you&me
B. you
C. me
D. err
[填空题]有以下程序:
#include <iostream>
#include <fstream>
using namespace std;
int main( )
fstream file;
file.open("abc.txt", ios_base::in);
if (! file )
cout<<"Can not open abc.txt"<<end1;
abort( );
char ch;
int i = 0;
while ( ! file.eof( ) )
file.get(ch);
i++;
cout<<"Characters : "<<i<<end1;
file.close( );
return 0;
程序实现的功能是 【15】 。
[单项选择]有如下的程序:
#include <cstring.h>
#include <iostream. h>
using namespace std;
class MyString public:
MyString(const char*s);
~MyString( ) delete[]data;
protected:
unsigned len;
char*data;
;
MyString::MyString(const char *s) len=strlen(s);
data=new char[len+ 1];
strcpy(data, s);int main( ) MyString a("C++ Programing");
MyString b(a);
return0;在运行上面的程序时出错,出错的原因是( )。
A. 构造函数的实参不允许是本类的对象
B. 没有定义实现深层复制(深拷贝)的复制构造函数
C. 构造对象a时实参与形参类型不符
D. 系统不能生成默认的复制构造函数
[单项选择]有如下程序 #include <iostream> #include <iomanip> using namespace std; class MyClass { public: MyClass( ) { cout<<’A’; } MyClass(char c){ cout<<c; } ~MyClass( ){ cout<<’B’; } }; int main( ) { MyClass p1,*p2; p2=new MyClass(’X’); delete p2; return 0; } 执行这个程序屏幕上将显示输出
A. ABX
B. ABXB
C. AXB
D. AXBB
[单项选择]有如下程序
#include <iostream>
#include <iomanip>
using namespace std;
int main( )
cout<<setprecision(3)<<fixed<<setfill('*')<<setw(8);
cout<<12.345<<______34.567;
return 0;
若程序的输出是:
**12.345**34.567
则程序中下划线处遗漏的操作符是( )。