C++ Program To Reverse a Sentence or String

Problem:- Write A C++ Program To Print Reverse Sentence or reverse a string in c++ program or how to reverse a string in c++ using functions or reverse a string in c++ using for loops or reverse string in c++ without using a function or how to reverse a string in c++ using strrev or Reversing a string in c using a while loop or C++ Program to Reverse a String or C program to reverse a given number using do..while loop or c++ program to reverse a string using for loop or C++ Program To Reverse a Sentence or String.

Check This:- Hacker rank solution for Strings, Classes, STL, Inheritance in C++.

Logic:- Like reverse string, this is a reverse sentence. So first we are taking an input from the user after that we are finding the string or sentence last index point so we can reverse a sentence while reversing a sentence if any space occurs we take and space and print space after that again string starts printing. I  strongly prefer a program first try to understand this program so can understand the logic basically what is going on. Check C Program For Reverse A String Without (srtrev) Using Library Function. Now try by yourself if you are getting problem Comment Below and also sure that you have read the full post.

Also Check:- Geeksforgeeks solution for School, Basic, Easy, Medium, Hard in C++.

Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date for a new post or if you have any Query you can ask there with lots of coders also suggest to your Friends to join and like our page.


using namespace std;
int main()

/*Visit - www.programmingwithbasics.com*/
    cout<<"\nVisit - www.programmingwithbasics.com";
  int i, prev, next, j, k;
  char st[100];

  cout<<"\n\nEnter The Sentence: ";


  cout<<"\n\nSentence In Reverse Order Is As Follow \n\n";
    if(st[k]==' '||k==0)
cout<<" ";

  return 0;


Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment