Professional Documents
Culture Documents
C++ Functions
C++ Functions
This program prompts 3 numbers and the number of times the user would
like to rotate said numbers, and returns the result. It uses three
functions to make the prompt and the calculation.
#include <iostream>
using namespace std;
int main()
{
int a, b, c, positions;
positions=prompt_and_get(a,b,c);
rotate(a, b, c, positions);
return 0;
}
if(position1 % 3 == 1)
{
e=x, f=y, d=z;
}
else if(position1 % 3 == 2)
{
d=y, e=z, f=x;
}
else
{
d=x, e=y, f=z;
}
}
cout << "How many positions do you want to rotate by? ";
cin >> positions;
return positions;
}