欧美一区2区三区4区公司二百,国产精品婷婷午夜在线观看,自拍偷拍亚洲精品,国产美女诱惑一区二区

字符串倒序

字符串倒序

#include <stdio.h>
#include <string.h>
#include <stack>
char *Strrev(char *s)
{
?char ch;
?char *p = s;
?char *q = s + strlen(s) - 1;
?while (p != q)
?{
? ch = *p;
? *p++ = *q;
? *q-- = ch;
?}
?return s;
}
char *Strrev_Recursion(char *s, char *p)
{
?if (s != p)
?{
? char ch = *s; *s = *p; *p = ch;
? Strrev_Recursion(++s, --p);
?}
?return --s;
}
char *_Strev(char *s)
{
?return Strrev_Recursion(s, s + strlen(s) - 1);
}

char *Strrev_WithoutRecursion(char *s)
{
?using std::stack;
?stack<char> aStack;
?char *p = s;
?while (*p != '/0')
? aStack.push(*p++);
?p = s;
?while (!aStack.empty())
?{
? *p++ = aStack.top();
? aStack.pop();
?}
?
?return s;
}
void main()
{
?char s[50] = "I am a student.";
?printf("%s/n", Strrev(s));
?
?printf("%s/n", _Strev(s));
?printf("%s/n", Strrev_WithoutRecursion(s));

字符串倒序

文章鏈接: http://www.qzkangyuan.com/15124.html

文章標題:字符串倒序

文章版權:夢飛科技所發布的內容,部分為原創文章,轉載請注明來源,網絡轉載文章如有侵權請聯系我們!

聲明:本站所有文章,如無特殊說明或標注,均為本站原創發布。任何個人或組織,在未征得本站同意時,禁止復制、盜用、采集、發布本站內容到任何網站、書籍等各類媒體平臺。如若本站內容侵犯了原著者的合法權益,可聯系我們進行處理。

給TA打賞
共{{data.count}}人
人已打賞
建站教程投稿分享

在CentOS7 mini版中如何設置防火墻及時間等

2022-12-29 23:57:35

建站教程投稿分享

遞歸遍歷文件

2022-12-30 0:02:16

0 條回復 A文章作者 M管理員
    暫無討論,說說你的看法吧
?
個人中心
購物車
優惠劵
今日簽到
有新私信 私信列表
搜索
主站蜘蛛池模板: 香格里拉县| 乌鲁木齐市| 定西市| 关岭| 砚山县| 美姑县| 兴业县| 阳西县| 田林县| 柳江县| 灵台县| 尉犁县| 永川市| 嫩江县| 新竹市| 福安市| 定州市| 新津县| 松江区| 靖西县| 同心县| 建德市| 湛江市| 南投市| 扎赉特旗| 肥城市| 九龙坡区| 荔波县| 鹤庆县| 台东市| 敖汉旗| 辉南县| 二连浩特市| 宁明县| 神农架林区| 仙桃市| 宝坻区| 绥江县| 长葛市| 壶关县| 什邡市|