扬智科技软件笔试题目第10题答案

时间:2020-11-16 16:55:24 笔试题目 我要投稿

扬智(科技)软件笔试题目第10题答案

第10题为:
10.Write a recursive function that tests wether a string is a palindrome.
A palindrome is s string such as "abcba" or "otto" that reads the same in
both directions.If you can write this function recursively,you can write
an iterative version of this function instead.

扬智(科技)软件笔试题目第10题答案

#include
#include
int count=0;//记录递归函数中字符串缩短的总次数,可以不要这个。
recp(char s[])//回文的.递归函数
{
int i;
if(strlen(s)==1)//长度为1
return 1;
else if(strlen(s)==2)长度为2的情况
{
if(s[0]==s[1])
return 1;
else
return 0;
}
else if(s[0]==s[strlen(s)-1])
{
count++;
cout<<"The "< char t[]="abcdeabcd";
int svalue,tvalue;
svalue=recp(s);
tvalue=recp(t);
cout<<"the value of string s is:"< cout<<"the value of string t is:"<}
在Visual C++6.0中通过。
 

 

【扬智(科技)软件笔试题目第10题答案】相关文章:

英智兴达软件测试笔试题目11-20

枫叶软件笔试题目与答案11-19

软件测试笔试题目及答案09-18

软件测试笔试题目(含答案)11-20

精选软件测试笔试题目及答案06-23

AutoCAD笔试题目真题和答案12-08

深圳嘉讯软件科技有限公司笔试题目11-14

软件测试常见笔试题目07-31

傲盾软件笔试题目11-19

面试笔试题目规律题及答案08-03