64 615
Assignments Done
99,1%
Successfully Done
In September 2018

Answer to Question #57383 in C++ for Mary Rose Vergara

Question #57383
rotate the word computer by 1 results is rCompute. If the input is 3, terCompu is the output.
Expert's answer
#include <iostream>
#include <string>

using namespace std;

int main() {
string s = "Computer";

int rot = 0;

cin >> rot;

for (int i = 0; i < s.length(); i++) {
cout << s[(i - rot) % s.length()];
}
return 0;
}

Result.
1
rCompute

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions