Senin, 18 April 2011

Driver program a for the function max()

The following is a function with two parameters that produce
greater value

#include<math.h>
#include<iostream.h>

int max (int x, int y) {
// hasil lebih luas dua bilangan bulat integers:
if (x<y)
return y;
else
return x;
}

int main () {
// uji max() fungsi:
int m,n;
do {
cin >> m << n;
cout << "max("<<m<<","<<n<<") ="<<max (m,n) << endl;
}
while (m != 0);
return 0;
}

   pay attention that the function has more than a question of return,
the first in the reach will end the function and generate value in the point
to the calling program.
Question return same with a question break,
that is the leaps question out of the body functions.
but at its base can be put anywhere.

0 komentar:

Blogger template 'Purple Mania' by Ourblogtemplates.com 2008

Jump to TOP