1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
#include <iostream>
void test (int, int, double&, double&, char&);
int main ()
{
double x = 289.4, y = 534.9 ;
char next = 'E' ;
std::cout << "before: x == " << x << ", y == " << y << ", next == '" << next << "'\n" ;
test( 'a', 10, x, y, next );
std::cout << " after: x == " << x << ", y == " << y << ", next == '" << next << "'\n" ;
}
void test( int a, int b, double& c, double& d, char& e )
{
// objects referred to by c, d and e may be modified by the function
c += a ;
d -= b ;
e = '!' ;
}
|