Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <tgmath.h>
  3.  
  4. #define ilosc_wynikow 100
  5.  
  6. void Generate_results(float Wsp_fun[], float A, float B, float Wynik_tab[], int wiel_tab) {
  7. float x, wynik;
  8. int i = 0;
  9. for (x = A; x < B; x = x + ((B - A) / wiel_tab)) {
  10. wynik = Wsp_fun[0] * sin(x + Wsp_fun[1]) * cos(x + Wsp_fun[2]);
  11. Wynik_tab[i] = wynik;
  12. i++;
  13. }
  14. }
  15.  
  16. void Print_results(float Wynik_tab[], int wielk_tab) {
  17. for (int i = 0; i < wielk_tab; i++)
  18. printf("%d wynik: %f \n", i + 1, Wynik_tab[i]);
  19. }
  20.  
  21. int main() {
  22. float A, B;
  23. float Wsp_fun[3], Wynik_tab[ilosc_wynikow];
  24. A = 3;
  25. B = 15;
  26. Wsp_fun[0] = 3.0;
  27. Wsp_fun[1] = 2.0;
  28. Wsp_fun[2] = 5.0;
  29.  
  30. Generate_results(Wsp_fun, A, B, Wynik_tab, ilosc_wynikow);
  31. Print_results(Wynik_tab, ilosc_wynikow);
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement