已知fun()函数的函数原型为“voidfun(intx,doubley=3.5,charz='#');”,则下面的函数调用中,不合法的调用是()。
A.f(1)
B.f(0,,'#')
C.f(3,3.7,'*')
D.f(2,4.2)
A.f(1)
B.f(0,,'#')
C.f(3,3.7,'*')
D.f(2,4.2)
试题7:编写类String的构造函数、析构函数和赋值函数,已知类String的原型为:
class String
{
public:
String(const char *str = NULL); // 普通构造函数
String(const String &other); // 拷贝构造函数
~ String(void); // 析构函数
String & perate =(const String &other); // 赋值函数
private:
char *m_data; // 用于保存字符串
};
试题7:编写类String 的构造函数、析构函数
和赋值函数,已知类String的原型为:
class String
{
public:
String(const char *str = NULL); // 普通构造函
数
String(const String &other); // 拷贝构造函数
~ String(void); // 析构函数
String & perate =(const String &other); // 赋值
函数
private:
char *m_data; // 用于保存字符串
};
A.*ff(int[],int)
B.int(*ff)(int*a,int)
C.void(*ff)(int*a,int)
D.void*ff(int*a,int)
A.void fun() friend class A;
B.Friend class A{private: int i; void fun();};
C.class A{private: int i; friend fun();};
D.class A{private: int i; friend void fun();};
下面函数的功能是将字符变量的值插入已经按ASCII码值从小到大排好序的字符串中。
void fun(char *w,char x,int *n)
{ int i,p=0;
while(x>w[p]) ①;
for(i=*n;i>=p;i--) ②;
w[p]=x;
++*n;
}
A.void f(int&) const;
B.const A * f(const int );
C.A& f(int, int=50);
D.A f(const int&) const;
A.chartest(int,int,int)
B.doubletest(int,int,double)
C.inttest(int,int,int=0)
D.floattest(int,int,int)
已知strcpy 的函数原型:char *strcpy(char
*strDest, const char *strSrc)其中strDest 是目的字符
串,strSrc 是源字符串。不调用C++/C 的字符串库
函数,请编写函数strcpy。