#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    28
    Rep Power
    0

    An algorithm for an IPO chart


    Hi everyone,

    I am new to the forum. I would like to know if someone can offer me some assistance. I am currently taking a beginners programming class and I want to know if someone can help me to write an algorithm for an IPO chart.

    I am supposed to write an algorithm for a program that calculates and displays the volume of a rectangular box. Can someone help?

    Thanks.
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,966
    Rep Power
    481
    Here is an example program for the geometrical problem. I don't know anything about money so I can't help you with the IPO chart.
    Code:
    #include<stdio.h>
    #include<math.h>
    
    void display_sphere(double radius,double volume) {
      int c;
      puts("       -------");
      puts("    --/       \\--");
      puts("   /             \\");
      puts("  /               \\");
      puts("  |               |");
      puts("  \\               /");
      puts("   \\             /");
      puts("    --\\       /--");
      puts("       -------");
      puts("");
      printf("Volume is %g cubic lengths\n",volume);
      puts("Use the arrow keys or mouse to rotate the sphere about any axis.");
      puts("Press enter to terminate.");
      while ((EOF != (c = getchar())) && ('\n' != c))
        ;
    }
    
    #define TAU (2*M_PI)  /* http://www.youtube.com/watch?v=jG7vhMMXagQ */
    
    double compute_sphere_volume(double radius) {
      /* Skip the triple integral and use the formula */
      return (2*TAU/3)*radius*radius*radius;
    }
    
    int main() {
      double radius;
      char buffer[30];
      puts("Enter sphere radius:");
      fgets(buffer,26,stdin);
      sscanf(buffer,"%lf ",&radius);
      display_sphere(radius,compute_sphere_volume(radius));
      return 0;
    }
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo