网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
函数String(2,"book")的值是_______。
A."bookbook"
B."BOOK"
C."bb"
D."o"
参考答案和解析
16
更多 “函数String(2,"book")的值是_______。A."bookbook"B."BOOK"C."bb"D."o"” 相关考题
考题
请编写一个函数int compare(char *s,char *t)), 该函数的功能是对两个字符串进行比较。当s所指字符串和t所指字符串相等时,返回值为0;当s所指字符串大于是t指字符串时,返回值大于0;当s所指字符串小于t所指字符串时,返回值小于0。注意:部分源程序已存在文件PROC8.cpp中。文件PROC8.cpp的内容如下://PROC8.cppinclude <iostream>include <string>using namespace std;int compare(char *s,char *t){//* * * * * * * * *}int main (){char str1[100],str2[100];int result;cout<<"Input the first string\n";cin>>str1;cout<<"Input the second string\n";cin>>str2;result=compare(str1,str2);if (result==0)cout<<"string1=string2 ! \n";else if (result>0)cout<<"string1>string2 ! \n";elsecout<<"string1<string2 ! \n";return 0;}
考题
假定程序中有以下语句: answer=MsgBox("String1",,"String2","String3",2) 执行该语句后,将显示一个信息框,此时如果单击“确定”按钮,则answer的值为 ______。A.String1B.String2C.String3D.1
考题
假定程序中有以下语句: answer=MsgBox("Stringl",,"String2","String3",2) 执行该语句后,将显示一个信息框,此时如果单击“确定”按钮,则answer的值为: ______。A.String1B.String2C.String3D.1
考题
编写函数fun(),函数的功能是:根据以下公式计算s,计算结果作为函数值返回;n通过形参传入。S=1+1/(1+2)+1/(1+2+3)+…+1/(1+2+3+…+n)例如:若n的值为11时,函数的值为1.833333。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <conio.h>include <stdio.h>include <string.h>float fun(int n){}main(){int n;float s;clrscr();printf("\nPlease enter N: ");scanf("%d",n);s=fun(n);printf("The result is:%f\n " , s);}
考题
阅读下列程序说明和C++程序,把应填入其中(n)处的字句,写对应栏内。【说明】下面的程序实现了类String的构造函数、析构函数和赋值函数。已知类String的原型为:class String{public:String(coust char * str = NULL); //普通构造函数String( const String other); //拷贝构造函数~String(void); //析构函数String perate =(const String other); //赋值函数private:char * m_data; // 用于保存字符串};//String 的析构函数String:: ~String (void){(1);}//String 的普通构造函数String: :String( const char * str){if (2){m_data = new char[1];*m_data = '\0';}else{int length = strlen(str);m_data = new ehar[ length + 1 ];strepy(m_data, str);}}//拷贝的构造函数String:: String( const String other){ int length = strlen(other. m_data);m_data = new char[ length + 1 ];strepy(m_data, other, m_data); //赋值函数String String::operate = (eonst String other) //{if (3)return * this;delete [] m_clara; //释放原有的内存资源int length = strlen( other, m_data);m_data = new chart length + 1 ];(4);return (5);}
考题
已知String类定义如下:class String{public:String(const char *str = NULL); // 通用构造函数String(const String another); // 拷贝构造函数~ String(); // 析构函数String perater =(const String rhs); // 赋值函数private:char *m_data; // 用于保存字符串};尝试写出类的成员函数实现。
考题
已知类 String 的原型为class string{public:string(const char *str=null);//普通构造函数string(const string other);//拷贝构造函数---string(void);string operate=(const string other);//赋值函数private:char * m-data;//用于保存字符串};请编写 string 的上述4 个函数
考题
编写类 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; // 用于保存字符串};请编写 String的上述 4 个函数。
考题
函数Rdata实现从文件in.dat中读取一篇英文文章存入到字符串数组string中,请编写函数CharLeft,其功能是:以行为单位把字符串中的所有字符的ASCII值左移4位,如果左移后,其字符的ASCII值小于等于32或大于100,则原字符保持不变,否则就把左移后的字符ASCII值再加上原字符ASCII值,得到新的字符仍存入原字符串对应的位置上。最后把已处理的字符串仍按行重新存入字符串数组string中,最后调用函数Wdata,把结果string输出到文件out.dat中。 原始数据文件存放的格式是:每行的宽度均小于80个字符(含标点符号和空格)。注意:部分源程序已经给出。 请勿改动主函数main、读数据函数Rdata和输出数据函数Wdata的内容。
考题
执行以下语句后,str2的值是( )。 String str1="abc"; String str2=strconcat("cde");A.abcdeB.abccdeC.cdeabcD.edccba
考题
执行语句“stringstr("abc");”时,系统会自动调用string类的构造函数()。A、string()B、string(constchar*s)C、string(conststringstr)D、string(size_typen,charc)
考题
面是创建Statement接口并执行executeUpdate方法的代码片段: conn=DriverManager.getConnection("jdbc:odbc:book","",""); stmt=conn.createStatement(); String strsql="insert into book values(’TP003’, ’ASP.NET’,’李’,’清华出版社’,35)"; n=stmt.executeUpdate(strsql); 代码执行成功后n的值为()。A、 1B、 0C、 -1D、 一个整数
考题
单选题如果奇函数f(x)在区间[a,b](0<a<b)上是增函数,且最小值为2,那么f(x)在区间[-b,-a]上是( ).A
增函数且最小值为-2B
增函数且最大值为-2C
减函数且最小值为-2D
减函数且最大值为-2
考题
单选题若有定义语句:char str1[] = "string", str2[8], *str3, str4[10] = "string";库函数strcpy的功能是复制字符串,以下选项中错误的函数调用是( )。A
strcpy(str3, "HELLO!");B
strcpy(str2, "HELLO!");C
strcpy(str1, "HELLO!");D
strcpy(str4, "HELLO!");
热门标签
最新试卷