1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#include <iostream>
using namespace std;
int quad(double a, double b, double c, double &r1, double &r2);
int main(){
int num = 0;
double a, b, c, r1, r2;
num = quad(a, b, c, r1, r2);
cout << "Enter A: ";
cin >> a;
cout << "Enter B: ";
cin >> b;
cout << "Enter C: ";
cin >> c;
return a, b, c;
int quad(double a, double b, double c, double &r1, double &r2){
}
if (num == 2){
cout << r1 << r2;
}
system("pause");
}
int quad(double a, double b, double c, double &r1, double &r2){
int det = (b*b - 4 * a*c);
if (det < 0){
cout << "There are no roots." << endl;
return 0;
}
return r1, r2;
}
|