examples/PIPS/libmexample/libmexample.c

00001 // libmexample.c
00002 //
00003 /*
00004 Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00005 
00006 Redistribution and use in source and binary forms, with or without
00007 modification, are permitted provided that the following conditions are met:
00008 
00009 * Redistributions of source code must retain the above copyright notice, this
00010   list of conditions and the following disclaimer.
00011 * Redistributions in binary form must reproduce the above copyright notice,
00012   this list of conditions and the following disclaimer in the documentation
00013   and/or other materials provided with the distribution.
00014 * Neither the name of Nokia Corporation nor the names of its contributors
00015   may be used to endorse or promote products derived from this software
00016   without specific prior written permission.
00017 
00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00019 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00021 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00022 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00023 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00024 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00025 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00026 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00027 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00028 
00029 Description:  
00030 */
00031 
00032 
00033 
00034 //This example demonstrates the use of math library functions.
00035 //In particular, the use of the gamma(double) function.
00036 
00037 // Include files.
00038 #include <math.h>
00039 #include <stdio.h>
00040 #include <stdlib.h>
00041 
00045 void PressKey()
00046         {
00047         fflush(stdout);
00048         getchar();
00049         }
00054 int main()
00055         {
00056         double inputValue = 0.0;
00057         double gammaValue = 0.0;
00058 
00059         printf("Welcome to the libm example!!!\n");
00060         printf("This example demonstrates the use of the gamma function from the math library.");
00061 
00062         printf("\n\nEnter an input value for the gamma function:");
00063         // Read input value for gamma function.
00064         scanf("%lf",&inputValue);
00065         //Call gamma function on read value.
00066         gammaValue = gamma(inputValue);
00067         printf("\nThe gamma of %lf is %lf\n",inputValue,gammaValue);
00068         PressKey();
00069         printf("\n Press Enter key to exit");
00070         PressKey();
00071 
00072         return EXIT_SUCCESS;// Returns the success code.
00073         }

Generated by  doxygen 1.6.2