Answer to Question #57383 in C++ for Mary Rose Vergara
rotate the word computer by 1 results is rCompute. If the input is 3, terCompu is the output.
1
2016-01-20T07:19:41-0500
#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!
Learn more about our help with Assignments:
C++
Comments
Leave a comment