我希望用户输入 strrev 的字符串来反转,但是当用户输入字符串时,由于某种原因不允许使用空格,所以如果有人输入 hello,我的名字是 stan。输出仅为 nats,我怎样才能让函数接受空格?
#include<iostream>
#include <cstring>
#include<string.h>
using namespace std;
int main()
{
char str[] = "This is a c-StyleString";
//cout <<"Enter the string:" << endl;
//cin >> str;
cout << "Reverse of the given string is: " << strrev(str);
return 0;
}
strrev
是一个已弃用的函数,仅在 Microsoft 工具链中可用,不应使用。您可以反转字符串std::reverse
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)