#include "stdafx.h"
#include "iostream"
#include "cmath"
using namespace std;
//alidoran
int main() {
int x, a, b, c;
float z1, z2, delta;
cout << "you must enter a,b,c in this method" << endl << "ax^2+bx+c=0"<<endl;
cout << "please input a:";
cin >> a ;
cout << "please input b:";
cin >> b;
cout << "please input c:";
cin >> c;
delta = (b * b ) - (4 * a*c);
if (delta < 0) {
cout << "dont have answer" << endl;
system("pause");
return 0;
}
z1 = ((-b) - sqrt(delta)) / (2 * a);
z2 = ((-b) + sqrt(delta)) / (2 * a);
if (z1==z2) cout << z1;
else cout << z1 << endl << z2 ;
cout << endl;
system("pause");
return 0;
}
- ۹۶/۱۱/۲۱