Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include<iostream>
  2. #include<string>
  3. #include "Źródło.h"
  4.  
  5. using namespace std;
  6.  
  7. int FunkcjaLiniowa(int a, int b, int x)
  8. {
  9. return (a*x) + b;
  10. }
  11. double* RownanieKwadratowe(int a, int b, int c, int *ilosc);
  12.  
  13.  
  14. int main()
  15. {
  16. int ilosc;
  17. RownanieKwadratowe(1,4,3,&ilosc);
  18.  
  19. cout << ilosc << endl;
  20.  
  21. system("PAUSE");
  22. return 0;
  23. }
  24.  
  25. double* RownanieKwadratowe(int a,int b,int c,int *ilosc )
  26. {
  27. //wyniki
  28. double x_1;
  29. double x_2;
  30. double*tab = NULL;
  31.  
  32. int delta = b * b - (4 * a*c);
  33. double pierwiastekDelta = sqrt(delta);
  34. if (delta > 0)
  35. {
  36. *ilosc = 2;
  37. x_1 = 0;
  38. x_2 = 0;
  39. tab = new double[2];
  40. tab[0] = x_1;
  41. tab[1] = x_2;
  42. return tab;
  43. }
  44. if (delta == 0)
  45. {
  46. *ilosc = 1;
  47. x_1 = 0;
  48. }
  49. if (delta<0)
  50. {
  51. *ilosc = 0;
  52. return tab;
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement