Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <cstring>
- using namespace std;
- int main()
- {
- int a, b, c;
- double disc, x1, x2;
- string res;
- cout << "a="; cin >> a;
- cout << "\nb="; cin >> b;
- cout << "\nc="; cin >> c;
- disc = b*b - 4 * a*c;
- if (disc < 0){
- cout << "Nu are solutii in multimea numerelor reale.";
- }
- else{
- x1 = (-b + sqrt(disc)) / (2 * a);
- x2 = (-b - sqrt(disc)) / (2 * a);
- res = "Solutiile sunt " + to_string(x1) + " si " + to_string(x2) + ".";
- cout << res;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement