Thread: calclulator

  1. #1
    just a learner |>|?\-/|\/|-]§)'s Avatar
    Join Date
    Jun 2009
    Location
    IN FRONT OF COMPUTER
    Posts
    19

    calclulator

    i have done this code which can do add, sub, mul, div and square. But this much function is not sufficient for a calculator. I want to add one exponential function and one square root function. plz help me frens
    |>|?\-/|\/|-]§)-(

  2. #2
    Grey Wizard C_Sparky's Avatar
    Join Date
    Sep 2009
    Posts
    50
    for square root:
    Code:
    {
      double param, result;
      param = 1024.0;
      result = sqrt (param);
      printf ("sqrt(%lf) = %lf\n", param, result );
      return 0;
    }
    Powers:
    Code:
    printf ("7 ^ 3 = %lf\n", pow (7,3));
      printf ("4.73 ^ 12 = %lf\n", pow (4.73,12));
      printf ("32.01 ^ 1.54 = %lf\n", pow (32.01,1.54));
      return 0;
    A simpler version of power:
    Code:
    pow(2, 3); //2 to the 3rd power

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed