Page 100 - Modular_V2.0_C++_Flikpbook
P. 100

void main()                                          DOSBox 0.74, Cpu speed: max 100% cycles, Frameskip 0, Program:

                  {                                                Enter any character: 7
                                                                   Your entered character is a digit.
                      char ch;
                      clrscr();
                      cout<< "Enter any character: ";

                      cin>> ch;
                      if(isalpha(ch))
                      {

                          cout<< "Your entered character is a letter.";
                      }                                                DOSBox 0.74, Cpu speed: max 100% cycles, Frameskip 0, Program:

                      else if(isdigit(ch))                         Enter any character: b
                                                                   Your entered character is a letter.
                      {

                          cout<< "Your entered character is a digit.";
                      }

                      else
                      {
                          cout<< "Your entered character is a symbol.";

                      }                                               DOSBox 0.74, Cpu speed: max 100% cycles, Frameskip 0, Program:
                      getch();                                     Enter any character: #
                                                                   Your entered character is a symbol._
                  }

                     FUNCTIONS OF MATH.H HEADER FILE

                  The math.h header file provides several mathematical and trigonometric functions that you can
                  use to perform various mathematical operations. Be sure to include math.h at the top of any
                  program. Some of the commonly used functions of the math.h header file are:

                   Function Name                              Use                             Example       Output
                   ceil(a)            It returns a after rounding up it to the nearest integer.  ceil(2.3)  3

                   fabs(a)            It returns the absolute value of a.                   fabs(-25.86)   25.86
                   floor(a)           It returns a after rounding down it to the nearest  floor(35.342) 35
                                      integer.
                   fmod(a, b)         It  returns  the  floating-point  reminder  after  fmod(2.3, 2)      0.3
                                      dividing the a by b.
                   pow(a, b)          It returns a raised to the power b.                   pow(2, 2)      4

                   sqrt(a)            It returns the square root of a. The value of a must  sqrt(49)       7
                                      be greater or equal to zero.
                   cos(a)             It returns the cosine of the angle a. The value of a  cos(90)        -0.448074
                                      must be in radians.

                   98
                          Touchpad MODULAR (Ver. 2.0)
   95   96   97   98   99   100   101   102   103   104   105