2016-04-18 6 views
0

strrevの文字列を入力して、ユーザが文字列を入力したときに何らかの理由で文字列を入力できないようにしたいと考えています。出力はnatsだけです、どうすれば空白を受け入れることができますか?strrevを使用してC++で文字列を正しく逆転する

#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; 
} 

答えて

4

strrevは非推奨の機能であり、Microsoftのツールチェーンでのみ使用でき、使用しないでください。 std::reverseで文字列を逆にすることができます。

+0

strrevの使用が必要な学校の割り当てであり、助けを求めているだけです。 – Beeeee

+5

@Beeeee、私は真剣に、冗談なし! – SergeyA

関連する問題