Advertisement
Guest User

Untitled

a guest
Nov 11th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string>
  6. #include <time.h>
  7. #include <windows.h>
  8. #include <conio.h>
  9. #include "r_kwadratowe.h"
  10.  
  11. using namespace std;
  12.  
  13. rKwadratowe::rKwadratowe(float aa,float bb,float cc, float wwynik, float wwynik2,float ddelta)
  14. {
  15.    a=aa;
  16.    b=bb;
  17.    c=cc;
  18.    wynik=wwynik;
  19.    wynik2=wwynik2;
  20.    delta=ddelta;
  21. }
  22.  
  23. rKwadratowe::~rKwadratowe()
  24. {
  25.     cout<<endl<<"Trwa wylaczanie...";
  26. }
  27.  
  28. void rKwadratowe::rkPodajLiczby()
  29. {
  30.     cout<<"Podaj a: ";
  31.     cin>>a;
  32.     cout<<"Podaj b: ";
  33.     cin>>b;
  34.     cout<<"Podaj c: ";
  35.     cin>>c;
  36. }
  37.  
  38.  
  39. void rKwadratowe::rkOblicz()
  40. {
  41.     delta=pow(b,2) - (4*a*c);
  42.     if(delta>0)
  43.     {
  44.         wynik = (-b - sqrt(delta)) / (2*a);
  45.         wynik2 = (-b + sqrt(delta)) / (2*a);
  46.     } else if (delta==0)
  47.     {
  48.         wynik = -b / (2 * a);
  49.     } else
  50.     {
  51.         wynik=-9328938238;
  52.         wynik2=-8493279864;
  53.     }
  54. }
  55.  
  56. void rKwadratowe::rkWyswietl()
  57. {
  58.     if(delta>0)
  59.     {
  60.         cout<<"Delta wynosi: "<<delta<<endl;
  61.         cout<<"Wynik 1 wynosi: "<<wynik<<endl;
  62.         cout<<"Wynik 2 wynosi: "<<wynik2<<endl;
  63.     }
  64.     else if (delta == 0)
  65.     {
  66.         cout<<"Delta wynosi: "<<delta<<endl;
  67.         cout<<"Wynik wynosi: "<<wynik<<endl;
  68.     }
  69.     else
  70.     {
  71.         cout<<endl<<"Nie ma wyniku! (delta wynosi mniej niz 0 lub nie podano cyfry)"<<endl;
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement