Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <tgmath.h>
- #define ilosc_wynikow 100
- void Generate_results(float Wsp_fun[], float A, float B, float Wynik_tab[], int wiel_tab) {
- float x, wynik;
- int i = 0;
- for (x = A; x < B; x = x + ((B - A) / wiel_tab)) {
- wynik = Wsp_fun[0] * sin(x + Wsp_fun[1]) * cos(x + Wsp_fun[2]);
- Wynik_tab[i] = wynik;
- i++;
- }
- }
- void Print_results(float Wynik_tab[], int wielk_tab) {
- for (int i = 0; i < wielk_tab; i++)
- printf("%d wynik: %f \n", i + 1, Wynik_tab[i]);
- }
- int main() {
- float A, B;
- float Wsp_fun[3], Wynik_tab[ilosc_wynikow];
- A = 3;
- B = 15;
- Wsp_fun[0] = 3.0;
- Wsp_fun[1] = 2.0;
- Wsp_fun[2] = 5.0;
- Generate_results(Wsp_fun, A, B, Wynik_tab, ilosc_wynikow);
- Print_results(Wynik_tab, ilosc_wynikow);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement