|
|
|
#include <iostream.h>
#include "equazioni3Lib.h"
void leggiDatiEquazione (float &a, float &b, float &c) {
cout << "Inserisci i coefficienti dell'equazione \n";
cin >> a;
cin >> b;
cin >> c;
return;
}
void stampaDatiEquazione (float a, float b, float c) {
cout << "------------ Equazione --------------\n";
cout << a << "x2+" << b <<"x+" << c << "=0 \n";
cout << "-------------------------------------\n";
return;
}
void stampaRadici (float x, float y) {
cout << "------------ Radici --------------\n";
cout << "Radici: x=" << x << ", y=" << y << endl;
cout << "-------------------------------------\n";
return;
}
float primaRadice (float a, float b, float c) {
float x;
x = (-b+sqrt(discriminante(a, b, c)))/(2*a);
return x;
}
float secondaRadice (float a, float b, float c) {
float y;
y = (-b-sqrt(discriminante(a, b, c)))/(2*a);
return y;
}
float discriminante (float a, float b, float c) {
float d;
d = b*b-4*a*c;
return d;
}
|
|