using namespace std;
string ReverseString(string str)
{
int Length = str.length();
string Temp;
for(int i=Length-1; i>=0; i--)
{
Temp += str[i];
}
return Temp;
}
int main()
{
string Message;
string GetVolcabulary;
while(true)
{
cout << "Please input message:" <<endl;
getline(cin,Message);
Message += " ";
for(int i=0; i<Message.length(); i++)
{
if(Message[i] != ' ')
{
GetVolcabulary += Message[i];
}
else
{
cout << ReverseString(GetVolcabulary) << " ";
GetVolcabulary = "";
}
}
cout << endl;
}
cin.get();
return 0;
}
沒有留言:
張貼留言