Solved

What Is the Code for a Loop That Iterates from the End

Question 17

Multiple Choice

What is the code for a loop that iterates from the end of a string toward the beginning?


A) string::reverse_iterator i{s.begin() }; while (i != s.end() )
{
Cout << *i;
++i;
}
B) string::reverse_iterator i{s.rbegin() }; while (i != s.rend() )
{
Cout << *i;
++i;
}
C) string::reverse_iterator i{s.end() }; while (i != s.begin() )
{
Cout << *i;
--i;
}
D) string::reverse_iterator i{s.rbegin() }; while (i != s.rend() )
{
Cout << *i;
--i;
}

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions