Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include <fstream>
- #include <cmath>
- using namespace std;
- int main(int argc, char *argv[])
- {
- ifstream fin( "c:\\input.txt" );
- ofstream fout( "c:\\output.txt" );
- double a,b,c,d;
- fin >> a >> b >> c;
- d = b*b-4*a*c;
- if (d>0) {
- double x1 = ( -b+sqrt(d)/(2*a) );
- double x2 = ( -b-sqrt(d)/(2*a) );
- fout << x1 << " " << x2 << endl;
- }
- if (d==0) {
- double x = -b/(2*a);
- fout << x << endl;
- }
- else {
- fout << "No salution " << endl;
- }
- fin.close();
- fout.close();
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement