I need a function to reverse a string passed in the following format cout << str
ID: 3627025 • Letter: I
Question
I need a function to reverse a string passed in the following formatcout << stringReverse(str) << endl;
declaration (i think) The variable in the object StrLib is cstr (which holds the string)
StrLib stringReverse(const StrLib &st){
StrLib temp;
temp = new char[st.length()+1];
for (....this is where im stuck)
...............
return temp;
Explanation / Answer
dear friend if u want a function to reverse a string i will give u a very simple one PLEASE RATE #include #include #include using namespace std; void print_reverse(string line) { int count=0; string words[100];//TO HOLD THE WORDS istringstream iss(line); do { string word;//A STRING VARIABLE iss >> word;//WILL SEARCH FOR WORDS TELL IT FINDS A SPACE words[count]=word; //ASSIGN THE WORD IN THE ARRAY count++; } while (iss);//WHILE THERE R STILL WORDS OR ANYTHING EXCEPT FOR SPACES OR NULL IN THE STRING WILL KEEP DOING THIS for (int i=count-1; i>=0; i--) coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.