aaa
true
True
False
第1题:
请编写一个函数int compare(char *s,char *t)), 该函数的功能是对两个字符串进行比较。当s所指字符串和t所指字符串相等时,返回值为0;当s所指字符串大于是t指字符串时,返回值大于0;当s所指字符串小于t所指字符串时,返回值小于0。
注意:部分源程序已存在文件PROC8.cpp中。
文件PROC8.cpp的内容如下:
//PROC8.cpp
include <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";
else
cout<<"string1<string2 ! \n";
return 0;
}
第2题:
表达式isinstance(3,object)的值为_____________。
第3题:
此题为判断题(对,错)。
第4题:
下列函数中,其返回值为字符型数据的函数是______。
A.LEN()
B.VAL()
C.STR()
D.DATE()
第5题:
(17)在窗体上有一个文本框,其名称为Text1,编写下列事件过程: Private Sub Text1_KeyPress(KeyAscii As Integer ) Dim str As String Str=Chr(KeyAscii) KeyAscii=Asc(UCase(str)) Text1.Test=String(2,KeyAscii) End Sub 程序运行后,如果在键盘上输入字母“a”则在文本框Text3中显示的内容为 A.aaa B.AAA C.AA D.aa
第6题:
使用VC++6.0打开考生文件夹下的源程序文件2.cpp。阅读下列函数说明和代码。函数num(ehar*str)用于返回字符串中非数字的个数。 例如:abcl23abc45 返回值为:6 将函数num补充完整。 注意:请勿改动主函数main。 试题程序: include<iostream.h> intnum(char*str) { } intmain { charstr[1024]; cout<<"pleaseinputastring:"<<endl; cin.getline(str,1024); cout<<"charnumberis"<<num(str)<<endl: return0; }
第7题:
下面函数的功能应该是:删除字符串str中所有与变量ch相同的字符,并返回删除后的结果,例如:若str=”ABCDABCD”,ch=”B”,则函数的返回值为:”ACDACD”
Function delchar(str As String,ch As String)As String
Dim kAs Integer,temp As String,ret As String
ret=””
For k=1 To Len(str)
temp=Mid(str,k,1)
If temp=ch Then
ret=ret&temp
End If
Next k
delchar=ret
End Function
但实际上函数有错误,需要修改,下面的修改方案中正确的是( )。
A.把ret=ret&temp改为ret=temp
B.把If temp=ch Then改为Iftemp<>ch Then
C.把delchar=ret改为delchar=temp
D.把ret=””改为temp=””
第8题:
A.2
B.-3
C.3
D.-2
第9题:
以下返回值是“False”的语句是( )。
A.Value=(10>4)
B.Value=(“ab”[]“aaa”)
C.Value=(“周”<“刘”)
D.Value=(#2004/9/13#=#2004/10/10#)
第10题:
设有以下语句: char str[4][12]={"aaa","bbbb","ccccc","dddddd"},*strp[4]; int i; for(i=0;i<4;i++) strp[i]=str[i]; 下列选项不是对字符正确引用的是(其中0≤k<4)( )。
A.strp
B.str[k][k]
C.* strp[k]
D.** strp