设有下列通用过程: Public Function Fun(xStr As String)As String Dim tStr As String,strL As Integer tStr="" strL=Len(xStr) i=strL/2 DO While i<=StrL tStr=tStr&Mid(xStr,i+1,1) i=i+1 Loop Fun=tStr&tStr End Function 在窗体上画一个名称为Textl的文本框和一个名称为Command1的命令按钮。然后编写下列的事件过程: Private Sub Commandl Click( ) Dim S1 As String S1="ABCDEF" Text1.Text=LCase(Fun(S1)) End Sub 程序运行后,单击命令按钮,文本框中显示的是( )。
A.ABCDEF
B.abedef
C.defdef
D.defabc
第1题:
设有下列通用过程:
Public Function Fun(xStr As String)As String
Dim tStr As String,strL As Integer
tStr=""
strL=Len(xStr)
i=strL/2
DO While i<=StrL
tStr=tStr&Mid(xStr,i+1,1)
i=i+1
Loop
Fun=tStr&tStr
End Function
在窗体上画一个名称为Textl的文本框和一个名称为Command1的命令按钮。然后编写下列的事件过程:
Private Sub Commandl Click( )
Dim S1 As String
S1="ABCDEF"
Text1.Text=LCase(Fun(S1))
End Sub
程序运行后,单击命令按钮,文本框中显示的是( )。
A.ABCDEF
B.abedef
C.defdef
D.defabc
第2题:
已知类 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 个函数
第3题:
已知String类定义如下:
class String
{
public:
String(const char *str = NULL); // 通用构造函数
String(const String &another); // 拷贝构造函数
~ String(); // 析构函数
String & perater =(const String &rhs); // 赋值函数
private:
char *m_data; // 用于保存字符串
};
尝试写出类的成员函数实现。
String::String(const char *str)
{
if ( str == NULL ) //strlen在参数为NULL时会抛
异常才会有这步判断
{
m_data = new char[1] ;
m_data[0] = '\0' ;
}
else
{
m_data = new char[strlen(str) + 1];
strcpy(m_data,str);
}
}
String::String(const String &another)
{
m_data = new char[strlen(another.m_data) + 1];
strcpy(m_data,other.m_data);
}
String& String::operator =(const String &rhs)
{
if ( this == &rhs)
return *this ;
delete []m_data; //删除原来的数据,新开一块内
存
m_data = new char[strlen(rhs.m_data) + 1];
strcpy(m_data,rhs.m_data);
return *this ;
}
String::~String()
{
delete []m_data ;
}
第4题:
设有如下通用过程:
Pubfic Function Fun(xStr As String)As String
Dim tStr As String,strL As Integer
tstr=“”
strL=Len(xStr)
i=1
Do While i<=strL/2
tStr=tStr&Mid(xStr,i,1)&Mid(xStr,strL-i+1,1)
i=i+1
Loop
Fun=tStr
EndFunction
在窗体上画一个名称为Commandl的命令按钮。然后编写如下的事件过程:
Private Sub Commandl_Click()
Dim S1 As String
S1=“abcdef”
Print UCase(Fun(S1))
End Sub
程序运行后,单击命令按钮,输出结果是
A.ABCDEF
B.abedef
C.AFBECD
D.DEFABC
第5题:
You are consuming a Windows Communication Foundation (WCF) service in an ASP. NET Web application.The service interface is defined as follows:[ServiceContract]public interface ICatalog{ [OperationContract] [WebGet(UriTemplate="/Catalog/Items/{id}", ResponseFormat=WebMessageFormat.Json)] string RetrieveItemDescription(int id); } The service is hosted at Catalogsvc.You need to call the service using jQuery to retrieve the description of an item as indicated by a variable named itemId. Which code segment should you use?()
A. $get(String.format("/Catalogsvc/Catalog/Items/id{0}", itemId) null, function (data) { ... }, javascript");
B. $get(String.format("/Catalogsvc/Catalog/Items/{0}", itemId), null, function (data) { ... }, "json");
C. $get(String.format("/Catalogsvc/Catalog/Items/{0}", itemld), null, function (data) { ... }, "xml");
D. $get(String.format("/Catalogsvc/Catalog/Items/id{0}", itemld), null, function (data) { ... }, "json");
第6题:
设有如下通用过程: Public Function Fun(xStr As String)As String Dim tStr As String,strL As Integer tStr="" strL=Len(xStr) i=1 Do While i<=strL/2 tStr=tStr & Mid(xStr,i,1) & Mid(xStr,strL-i+1,1) i=i+1 Loop Fun=tStr End Function 在窗体上画一个名称为Text1的文本框和一个名称为Command1的命令按钮。然后编写如下的事件过程: Private Sub Command1_Click() Dim S1 As String S1="abcdef" Text1.Text=UCase(Fun(S1)) End Sub 程序运行后,单击命令按钮,则Text1中显示的是______。
A.ABCDEF
B.abcdef
C.AFBECD
D.DEFABC
第7题:
设有如下通用过程: Public FunctionFun(x Str As String)As String DimtStr As String,strL As Integer tStr="" strL=Len(xStr) i=1 DoWhilei<=strL/2 tStr=tStr&Mid(xStr,i,1)&Mid(xStr,strL-i+1,1)" i=i+1 Loop Fun=tStr End Function 在窗体
A.ABCDEF
B.abcdef
C.AFBECD
D.DEFABC
第8题:
( 27 )设有如下通用过程:
Public Function Fun(xStr As String) As String
Dim tStr As String, strL As Integer
tStr = ""
strL = Len(xStr)
i = 1
Do While i <= strL / 2
tStr = tStr & Mid(xStr, i, 1) & Mid(xStr, strL - i + 1, 1)
i = i + 1
Loop
Fun = tStr
End Function
在窗体上画一个名称为 Text1 的文本框和一个名称为 Command1 的命令按钮。然后编写如下的事件过程:
Private Sub Command1_Click()
Dim S1 As String
S1 = "abcdef"
Text1.Text = UCase(Fun(S1))
End Sub
程序运行后,单击命令按钮,则 Text1 中显示的是
A ) ABCDEF
B ) abcdef
C ) AFBECD
D ) DEFABC
第9题:
设有如下通用过程:
Public Function Fun(xStr As String)
Dim tStr As String, srtL As Integer
tStr+" "
strL=Len(xStr)
i=1
Do While i <=strL/2
tStr=tStr &Mid(xStr,i ,1)& Mid (xStr ,strL-i+1,1)
i=i+1
Loop
Fun=tStr
End Function
在窗体上画一个名称为 Textl 的文本框和一个名称为 Command1 的命令按钮,然后编写如下的事件过程:
Private Sub Command 1_ Click()
Dim S1 As String
S1="abcdef"
Text1.Text=UCase(Fun(S1))
End Sub
程序运行后,单击命令按钮,则Text1中显示的是( )。 A.ABCDEF
B.abcdef
C.AFBECD
D.DEFABC