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;

}

}

}

#include "pch.h" #include #include using namespace std; void revStringWords(string &str); int main()

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!