Sunday, 6 May 2012

Using math.h in C++


#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
  double anyNumber;
  cout << "Enter a number: ";
  cin >> anyNumber;
  cout << "The ABS value = "; cout << abs(anyNumber);
  cout << "\nThe ACOS value = "; cout << acos(anyNumber);
  cout << "\nThe ASIN value = "; cout << asin(anyNumber);
  cout << "\nThe ATAN value = "; cout << atan(anyNumber);
  cout << "\nThe COS value = "; cout << cos(anyNumber);
  cout << "\nThe EXP value = "; cout << exp(anyNumber);
  cout << "\nThe LOG value = "; cout << log(anyNumber);
  cout << "\nThe SIN value = "; cout << sin(anyNumber);
  cout << "\nThe SQRT value = "; cout << sqrt(anyNumber);
  cout << "\nThe TAN value = "; cout << tan(anyNumber);
  cout << "\nThe ACOS value = "; cout << acos(anyNumber);
  cout << "\nPress ENTER to continue..." << endl;
  getchar();
  getch();
  main();
  return 0;
}

No comments:

Post a Comment