examples/PIPS/libmexample/libmexample.c

00001 // libmexample.c
00002 //
00003 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
00004 // All rights reserved.
00005 // This component and the accompanying materials are made available
00006 // under the terms of "Eclipse Public License v1.0"
00007 // which accompanies this distribution, and is available
00008 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00009 //
00010 // Initial Contributors:
00011 // Nokia Corporation - initial contribution.
00012 //
00013 // Contributors:
00014 //
00015 // Description:
00016 //
00017 
00018 
00019 //This example demonstrates the use of math library functions.
00020 //In particular, the use of the gamma(double) function.
00021 
00022 // Include files.
00023 #include <math.h>
00024 #include <stdio.h>
00025 #include <stdlib.h>
00026 
00030 void PressKey()
00031         {
00032         fflush(stdout);
00033         getchar();
00034         }
00039 int main()
00040         {
00041         double inputValue = 0.0;
00042         double gammaValue = 0.0;
00043 
00044         printf("Welcome to the libm example!!!\n");
00045         printf("This example demonstrates the use of the gamma function from the math library.");
00046 
00047         printf("\n\nEnter an input value for the gamma function:");
00048         // Read input value for gamma function.
00049         scanf("%lf",&inputValue);
00050         //Call gamma function on read value.
00051         gammaValue = gamma(inputValue);
00052         printf("\nThe gamma of %lf is %lf\n",inputValue,gammaValue);
00053         PressKey();
00054         printf("\n Press Enter key to exit");
00055         PressKey();
00056 
00057         return EXIT_SUCCESS;// Returns the success code.
00058         }

Generated by  doxygen 1.6.2