![](https://static.youtibao.com/asksite/comm/h5/images/m_q_title.png)
下面函数的功能是()。int fun (char*x){char*y=x;while(*y++);return(y-x-1);}
A.[A] 求字符串的长度
B.[B] 比较两个字符串的大小
C.[C] 将字符串x复制到字符串y
D.[D] 将字符串x连接到字符串y后面
![](https://static.youtibao.com/asksite/comm/h5/images/m_q_a.png)
A、[A] 求字符串的长度
![](https://static.youtibao.com/asksite/comm/h5/images/solist_ts.png)
A.[A] 求字符串的长度
B.[B] 比较两个字符串的大小
C.[C] 将字符串x复制到字符串y
D.[D] 将字符串x连接到字符串y后面
A、[A] 求字符串的长度
A.c=fun(a,4,b);
B.c=fun(a[],4,&b);
C.c=fun(a[4],4,b);
D.c=fun(a,4,&b);
A.int(*p)(int,int)
B.int*p(int,int)
C.int*p[int,int]
D.以上选项都不对
下面程序的功能是:根据输入的整数x和n,利用函数fact实现求。 例如:输入:2,3 输出
=8 请在程序中的横线上填入正确的内容,将程序补充完整。 /* c7-1.c 利用函数fact实现求x的n次方*/ #include "stdio.h" int main() { long int fact(long x,long n) ; /*声明fact函数*/ long int x ; long int n; printf("please enter X and N(>=0): "); scanf("%ld,%ld", &x, &n ); printf("%ld,%ld=%ld",x,n, (1) ); /*调用fact函数 */ return 0; } long int fact(long int x, long int n) /*定义fact函数求xn */ { long int i,s; (2) ; /*求累积变量的初始化*/ if (n= =0) return 0; for(i=1; i<=n; i++) *用循环实现xn* s="s*x;" (3) ; *返回结果xn*>
A.5,4
B.5,4.8
C.3,4.6
D.3,4
根据下面类中Give 函数的原型和注释写出它的类外定义。
class Strings {
char *s; // 指向动态分配的字符串数组空间
int n; // 记录字符串长度
public:
Strings(char*str); // 构造函数,利用str 字符串长度初始化n,
// 利用str 字符串初始化s 所指的字符串空间
Strings(Strings& str); // 拷贝构造函数
Strings& Give(Strings& str); // 实现str 赋值给*this 的功能并返回*this
Strings Uion(Strings& str); // 实现*this 和str 中的字符串合并的
// 功能,把合并结果存入临时对象并返回
int Lenth() {return n;} // 返回字符串长度
void Print() {cout<<s<<endl;} // 输出字符串
};
A、private void demo(){...}
B、public int demo(){...}
C、public void demo2(){...}
D、public int demo(intm,floatf){...}
A.0
B.-1
C.5
D.6
A.A operator ++(int);
B.A operator ++();
C.A operator ++(0);
D.A operator ++(A,int);
根据下面类中Reverse 函数成员的原型和注释写出它的类外定义。
class AA {
int* a;
int n;
int MS;
public:
void InitAA(int aa[], int nn, int ms) {
if(nn>ms) {cout<< "Error!"<< endl; exit(1);}
MS=ms;
n=nn;
a=new int[MS];
for(int i=0; i
}
AA* Reverse(); // 对于调用该函数的对象,将其a 数组中前n 个
// 元素值按相反的次序排列,返回指向该对象的指针。
};
A.将字符串s1拷贝给s
B.将字符串s拷贝给s1
C.统计字符串s1中有效字符个数
D.将字符串s1连接到s末尾