Minggu, 10 April 2011

case of 5.2-5 weeks

case of 5.2-5 weeks
  which determines the largest value of 2 integers.

Maximum function 2 (input a, b: integer): integer
Description
      if (a> b) then return a
      else return b

The program is as follows:

# include <iostream>
  The biggest double (double x, double y)
  {
  double maximum = x;
  if (maximum> y)
      maximum = x;
      return (maximum);
      }
  int main ()
  {
  double a, b;
  a = largest (6.5, 20);
  b = largest (4.5);

  court <<"a =" <<a <<endl;
  court <<"b =" <<b <<endl;
  return (0);
  }


The program above has two argmen of type double and give
the return value of type double form the largest number among the second argument.

Tidak ada komentar:

Posting Komentar