早教吧作业答案频道 -->其他-->
下面代码中的“if(key[i].compare(c)==0)return1;”这句语句是什么意思stringkey[15]={"begin","end","if","then","else","while","write","read","do","call","const","char","until","procedure","repeat"};intIskey(stringc){//关键字判
题目详情
下面代码中的“ if(key[i].compare(c)==0) return 1;”这句语句是什么意思
string key[15]={"begin","end","if","then","else","while","write","read",
"do","call","const","char","until","procedure","repeat"};
int Iskey(string c){ //关键字判断
int i;
for(i=0;i
string key[15]={"begin","end","if","then","else","while","write","read",
"do","call","const","char","until","procedure","repeat"};
int Iskey(string c){ //关键字判断
int i;
for(i=0;i
▼优质解答
答案和解析
compare是CString的成员函数,比较两个字符串的
【Zero if the strings are identical, < 0 if this CString object is less than lpsz, or > 0 if this CString object is greater than lpsz.】
if(key[i].compare(c)==0) return 1;
是key[i]与c比较,相等,直接返回1;
不等,一直不断比较,都不等,返回0
因此,这段代码就是判断c是否是关键字之一.
【Zero if the strings are identical, < 0 if this CString object is less than lpsz, or > 0 if this CString object is greater than lpsz.】
if(key[i].compare(c)==0) return 1;
是key[i]与c比较,相等,直接返回1;
不等,一直不断比较,都不等,返回0
因此,这段代码就是判断c是否是关键字之一.
看了下面代码中的“if(key[i...的网友还看了以下:
c语言do while 写一个输入N个整数(个数不限)从它们中选出一个最大的打印出来我的写法如下# 2020-05-13 …
I will lend you my book if you _________ it.A.rea 2020-05-16 …
If you_ it ,I will lend the nove to you.A.read B. 2020-05-16 …
写出下列算法的功能LinkListdemo(LinkListL){ListNode*q,*p;If 2020-05-17 …
下列函数的功能是实现带头结点单链表按升值排序(填写空白处)voidsort(slink*11){s 2020-05-17 …
单片机取反while(1){if(kg==0){yanshi(5);if(kg==0)while( 2020-07-09 …
单片几中P1=~count;其中~是什么意思啊voidmain(void){while(1){if 2020-07-23 …
c语言任何一个自然数的立方等于连续奇数之和验证上面结论:如,1^3=1;2^3=3+5;3^3=7+ 2020-12-17 …
since,while,even,if这四个词的用法和意思都有那些,要全啊高中英语单选since,w 2021-02-02 …
下面代码中的“if(key[i].compare(c)==0)return1;”这句语句是什么意思s 2021-02-15 …