Question: #include pch.h #include #include using namespace std; void revStringWords(string &str); int main() { string str; cout getline(cin, str); revStringWords(str); cout return 0; } void revStringWords(string
#include "pch.h"
#include
#include
using namespace std;
void revStringWords(string &str);
int main()
{
string str;
cout
getline(cin, str);
revStringWords(str);
cout
return 0;
}
void revStringWords(string &str)
{
char temp;
int start, end, i, j = 0, len;
len = str.length();
for (i = 0; i
{
temp = str[i];
str[i] = str[len - 1 - i];
str[len - 1 - i] = temp;
}
for (i = 0; i
{
if (str[i] == '\0' || str[i] == '\0')
{
for (start = j, end = i - 1; start
{
temp = str[start];
str[start] = str[end];
str[end] = temp;
}
j = i + 1;
}
}
}

I want to revese the sentence, But it seems not work. could some one to help. Thank you very much Using C++
The below is example
Example Input: The movie was not very true to the book. Output: book the to true very not was movie The
Microsoft Visual Studio Debug Console Enter string: the cute dog After reversing words: the cute dog
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
