Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Standard view
Full view
of .
×
0 of .
Results for:
P. 1
C++ Functions

# C++ Functions

Ratings: (0)|Views: 827|Likes:
Comp Sci Lab. Lindenwood University.
Comp Sci Lab. Lindenwood University.

### Availability:

See More
See less

07/11/2010

pdf

text

original

Property of Lindenwood University.C++ Functions ClassA Basic Rotate FunctionThis program prompts 3 numbers and the number of times the user wouldlike to rotate said numbers, and returns the result. It uses threefunctions to make the prompt and the calculation.#include <iostream>using namespace std;void print_triple(int, int, int);void rotate(int&, int&, int&, int);int prompt_and_get(int&, int&, int&);int main(){int a, b, c, positions;positions=prompt_and_get(a,b,c);cout << "Before rotate, values are: ";print_triple(a, b, c);rotate(a, b, c, positions);cout << "After rotate, values are: ";print_triple(a, b, c);return 0;}void print_triple(int x, int y, int z){cout << x << " " << y << " " << z << endl;}void rotate(int &d, int &e, int &f, int position1){int x=d, y=e, z=f;if(position1 % 3 == 1){e=x, f=y, d=z;}else if(position1 % 3 == 2){d=y, e=z, f=x;}else

## Activity (4)

### Showing

AllMost RecentReviewsAll NotesLikes