jazykc
2013.3
upoljazykc
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Macros
Pages
funkce-s-promennym-poctem-parametru
suma-komplexnich-cisel.c
Go to the documentation of this file.
1
2
33
//Povolené knihovny:
34
#include <stdio.h>
35
#include <stdlib.h>
36
#include <stdarg.h>
37
39
#ifndef FUNKCE_S_PROMENNYM_POCTEM_PARAMETRU_H_INCLUDED
40
typedef
struct
komplexni
{
41
double
re
;
42
double
im
;
43
}
komplexni
;
44
#endif
45
46
komplexni
suma (
int
pocet, ...) {
47
va_list args;
48
int
i;
49
komplexni
vysledek = {0.0, 0.0}, komplex;
50
51
va_start(args, pocet);
52
for
(i=0; i<pocet; i++) {
53
komplex = va_arg(args,
komplexni
);
54
vysledek.
re
+= komplex.re;
55
vysledek.
im
+= komplex.im;
56
}
57
va_end(args);
58
return
vysledek;
//vracime struct hodnotou
59
}
60
61
int
main(
void
) {
62
komplexni
vysledek;
63
komplexni
k1={1,1};
64
komplexni
k2={2,2};
65
komplexni
k3={3,3.003};
66
67
vysledek = suma(3, k1, k2, k3);
68
printf(
"Suma je %g + %gi. \n"
, vysledek.
re
, vysledek.
im
);
69
return
0;
70
}
komplexni
Definition:
suma-komplexnich-cisel.c:40
komplexni
struct komplexni komplexni
komplexni::re
double re
Definition:
suma-komplexnich-cisel.c:41
komplexni::im
double im
Definition:
suma-komplexnich-cisel.c:42
Generated on Sat Dec 7 2013 22:57:26 for jazykc by
1.8.5