jazykc
2013.3
upoljazykc
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Macros
Pages
celkova-koncepce-programu
vypocet.c
1
#include "vypocet.h"
2
#include <math.h>
3
4
double
valec_objem(
double
r,
double
h) {
5
return
M_PI * r*r * h;
6
}
7
8
double
valec_povrch(
double
r,
double
h) {
9
double
obvod = 2.0 * M_PI * r;
10
return
obvod * r
//dve podstavy
11
+ obvod * h;
//plast
12
}
13
14
#define NUHEL(n,s) ((n)/4.0 * (s)*(s) * cos(M_PI/(n))/sin(M_PI/(n)))
15
16
/* n-uhelnik: n/4 s^2 cotg PI/n
17
*
18
* cotg = cos/sin
19
*/
20
double
hranol_objem(
long
n,
double
s,
double
h) {
21
return
s*s * 0.25*n * cos(M_PI/n)/sin(M_PI/n) * h;
22
}
23
24
double
hranol_povrch(
long
n,
double
s,
double
h) {
25
return
n/2.0 * s*s * cos(M_PI/n)/sin(M_PI/n)
//dve podstavy
26
+ s*n * h;
//plast
27
}
Generated on Sat Dec 7 2013 22:57:26 for jazykc by
1.8.5