Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Download
Standard view
Full view
of .
Add note
Save to My Library
Sync to mobile
Look up keyword
Like this
4Activity
×
0 of .
Results for:
No results containing your search query
P. 1
C++ Functions

C++ Functions

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

More info:

Published by: Ruben_Montero_6740 on Apr 07, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, DOC, TXT or read online from Scribd
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

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->