![Data Structures and Algorithms in C++](https://www.bartleby.com/isbn_cover_images/9780470383278/9780470383278_largeCoverImage.gif)
Data Structures and Algorithms in C++
2nd Edition
ISBN: 9780470383278
Author: Michael T. Goodrich
Publisher: Wiley, John & Sons, Incorporated
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 3, Problem 19C
Explanation of Solution
Program code:
//include the required header files
#include <iostream>
#include <string>
#include <algorithm>
//use std namespace
using namespace std;
//declare a function revStr()
void revStr(string::iterator begin, string::iterator end);
//define main() function
int main(int argc, char *argv[])
{
//create a string s.
string s;
//iterate a while loop
while (true)
{
//print the symbol
cout << "> ";
//get the values
getline(cin,s);
//call the function revStr() to reverse the value
revStr(s.begin(), s.end());
//print the value of s
cout << s << endl;
}
//return
return 0;
}
//define the functio
void revStr(string::iterator begin, string::iterator end)
{
//if the condition is true,
if (end <= begin)
//return
return;
//swap the values
Expert Solution & Answer
![Check Mark](/static/check-mark.png)
Want to see the full answer?
Check out a sample textbook solution![Blurred answer](/static/blurred-answer.jpg)
Chapter 3 Solutions
Data Structures and Algorithms in C++
Ch. 3 - Prob. 1RCh. 3 - Prob. 2RCh. 3 - Prob. 3RCh. 3 - Describe a way to use recursion to compute the sum...Ch. 3 - Prob. 5RCh. 3 - Prob. 7RCh. 3 - Prob. 8RCh. 3 - Prob. 10RCh. 3 - Prob. 11RCh. 3 - Draw the recursion trace for the execution of...
Ch. 3 - Draw the recursion trace for the execution of...Ch. 3 - Prob. 14RCh. 3 - Prob. 17RCh. 3 - Prob. 3CCh. 3 - Prob. 4CCh. 3 - Prob. 5CCh. 3 - Prob. 6CCh. 3 - Prob. 7CCh. 3 - Prob. 8CCh. 3 - Prob. 9CCh. 3 - Prob. 10CCh. 3 - Prob. 11CCh. 3 - In the Towers of Hanoi puzzle, we are given a...Ch. 3 - Describe a recursive function for converting a...Ch. 3 - Prob. 14CCh. 3 - Write a recursive C++ program that will output all...Ch. 3 - Write a short recursive C++ function that finds...Ch. 3 - Prob. 17CCh. 3 - Write a short recursive C++ function that will...Ch. 3 - Prob. 19CCh. 3 - Prob. 20CCh. 3 - Use recursion to write a C++ function for...Ch. 3 - Suppose you are given two circularly linked lists,...Ch. 3 - Suppose you are given two circularly linked lists,...Ch. 3 - Prob. 1PCh. 3 - Prob. 2PCh. 3 - Write a program that can solve instances of the...
Knowledge Booster
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
![Text book image](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
![Text book image](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
![Text book image](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
![Text book image](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
![Text book image](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education