目前本站已有 十几万 份求职资料啦!


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

10-15 23:59:20 来源:http://www.qz26.com 笔试题目   阅读:8996
导读:第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 inboth directions.If you can write this function recursively,you can writean iterative version of this function instead.#include #include int count=0;//记录递归函数中字符串缩短的总次数,可以不要这个。recp(char s[])//回文的递归函数{int i;if(strlen(s)==1)//长度为1return 1;else if(strlen(s)==2)长度为2的情况{if(s[0]==s[1])return 1;e
扬智(科技)软件笔试题目第10题答案,标签:银行笔试题目,企业笔试题目,http://www.qz26.com

第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.

#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中通过。
 


Tag:笔试题目银行笔试题目,企业笔试题目求职笔试面试 - 笔试题目
【字号: 】 【打印】 【关闭
《扬智(科技)软件笔试题目第10题答案》相关文章
最新更新
推荐热门
联系我们 | 网站地图 | 财务资料 | 范文大全 | 求职简历 | 财会考试 | 成功励志
Copyright 二六求职资料网 All Right Reserved.
1 2 3 4 5 6 7 8 9 10