에서 나는 문장을 입력하고 뒤로를 인쇄하는 프로그램 ...인쇄 뒤로 C++ 여기
#include<iostream>
#include<string>
using namespace std;
int main(int argc, char* argv[]) {
string scrambleWords;
cout << "Please enter a sentence to scramble: ";
getline(cin, scrambleWords);
for (int print = scrambleWords.length() - 1; print >= 0; print--)
{
if (isspace(scrambleWords[print]))
{
for (unsigned int printIt = print + 1;
printIt < scrambleWords.length(); printIt++)
{
cout << scrambleWords[printIt];
if (isspace(scrambleWords[printIt]))
break;
}
}
}
for (unsigned int gotIt = 0; gotIt < scrambleWords.length(); gotIt++)
{
cout << scrambleWords[gotIt];
if (isspace(scrambleWords[gotIt]))
break;
}
cout << endl;
}
// OUTPUT
// Please enter a sentence: birds and bees
// beesand birds
// Press any key to continue . . .
당신은 꿀벌 사이에 공간이 & 새가 없었다 볼 수있는 바와 같이, 그래서 어떻게 내가 공간을 추가 할 수 있습니다 거기에?
다음 단어와 공백을 인쇄합니다. 꿀벌 다음에 공간이 없으므로 아무 것도 인쇄되지 않습니다. – broncoAbierto