Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <string>
- using namespace std;
- void QuadraticEquation(int a, int b, int c, double &firstRoot, double &secondRoot){
- string equation = to_string(a) + "x^2 + " + to_string(b) + "x + " + to_string(c);
- double discr = pow(b, 2) - 4 * a * c;
- if (discr >= 0)
- {
- firstRoot = (-b + sqrt(discr)) / double(2 * a);
- secondRoot = (-b - sqrt(discr)) / double(2 * a);
- }
- else
- {
- cout << "No real Root" << endl;
- }
- }
- void CallRoot(){
- int a;
- int b;
- int c;
- double first = 0;
- double second = 0;
- cin >> a >> b >> c;
- QuadraticEquation(a, b, c, first, second);
- cout << first << endl;
- cout << second << endl;
- }
- ///////////////////////////////////////////////
- ////////////////////////// Quadratic Equaation
- /////////////////////////////////////////////////
- int main(){
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement