Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I wrote this code to read string in revers, but for some reason it doesn't want to read it right. Can you tell me what

I wrote this code to read string in revers, but for some reason it doesn't want to read it right. Can you tell me what is the issue;

#include

#include

#include

using namespace std;

int main() {

string uText;

string otvet = "";

cin >> uText;

int x = uText.size()-1;

getline(cin, uText);

while (uText == "Quit" || uText == "quit" || uText == "q") {break;}

for(int i = x ; i >= 0; --i)

{

otvet.push_back(uText.at(i));

}

cout << otvet << endl;

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

Do you believe that Matilda overreacted to James? Why or why not?

Answered: 1 week ago