
September 2nd, 2012, 07:22 PM
|
 |
Contributing User
|
|
|
|
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!
|