Answered step by step
Verified Expert Solution
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started