【发布时间】:2016-08-10 07:54:15
【问题描述】:
我希望用户输入字符串以使 strrev 反转,但是当用户输入字符串时,由于某种原因不允许使用空格,所以如果有人输入你好,我的名字是 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;
}
【问题讨论】: