Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string>
- #include <time.h>
- #include <windows.h>
- #include <conio.h>
- #include "r_kwadratowe.h"
- using namespace std;
- rKwadratowe::rKwadratowe(float aa,float bb,float cc, float wwynik, float wwynik2,float ddelta)
- {
- a=aa;
- b=bb;
- c=cc;
- wynik=wwynik;
- wynik2=wwynik2;
- delta=ddelta;
- }
- rKwadratowe::~rKwadratowe()
- {
- cout<<endl<<"Trwa wylaczanie...";
- }
- void rKwadratowe::rkPodajLiczby()
- {
- cout<<"Podaj a: ";
- cin>>a;
- cout<<"Podaj b: ";
- cin>>b;
- cout<<"Podaj c: ";
- cin>>c;
- }
- void rKwadratowe::rkOblicz()
- {
- delta=pow(b,2) - (4*a*c);
- if(delta>0)
- {
- wynik = (-b - sqrt(delta)) / (2*a);
- wynik2 = (-b + sqrt(delta)) / (2*a);
- } else if (delta==0)
- {
- wynik = -b / (2 * a);
- } else
- {
- wynik=-9328938238;
- wynik2=-8493279864;
- }
- }
- void rKwadratowe::rkWyswietl()
- {
- if(delta>0)
- {
- cout<<"Delta wynosi: "<<delta<<endl;
- cout<<"Wynik 1 wynosi: "<<wynik<<endl;
- cout<<"Wynik 2 wynosi: "<<wynik2<<endl;
- }
- else if (delta == 0)
- {
- cout<<"Delta wynosi: "<<delta<<endl;
- cout<<"Wynik wynosi: "<<wynik<<endl;
- }
- else
- {
- cout<<endl<<"Nie ma wyniku! (delta wynosi mniej niz 0 lub nie podano cyfry)"<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement