19 lines
311 B
C++
19 lines
311 B
C++
//example of using passing by reference to return multiple values
|
|
#include <iostream>
|
|
using namespace std;
|
|
|
|
int goofyFunction(int n, int &mod){
|
|
mod = n % 3;
|
|
return n - 1;
|
|
}
|
|
|
|
int main(){
|
|
int thing = 5;
|
|
int mod = -1;
|
|
|
|
thing = goofyFunction(thing,mod);
|
|
|
|
cout << thing << endl;
|
|
cout << mod << endl;
|
|
}
|