#include<iomanip> using namespace std; int main() { double a,b,c,dt,x1,x2; cin>>a>>b>>c; dt=sqrt(b*b-4*a*c); x1=(-b+dt)/(2*a); x2=(-b-dt)/(2*a); cout<<fixed<<setprecision(2)<<x1<<" "<<fixed<<setprecision(2)<<x2<<endl; } /* Main.cc: In function 'int main()': Main.cc:6:2: error: 'cin' was not declared in this scope cin>>a>>b>>c; ^~~ Main.cc:6:2: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'? Main.cc:2:1: +#include <iostream> using namespace std; Main.cc:6:2: cin>>a>>b>>c; ^~~ Main.cc:8:5: error: 'sqrt' was not declared in this scope dt=sqrt(b*b-4*a*c); ^~~~ Main.cc:8:5: note: suggested alternative: 'qsort' dt=sqrt(b*b-4*a*c); ^~~~ qsort Main.cc:14:2: error: 'cout' was not declared in this scope cout<<fixed<<setprecision(2)<<x1<<" "<<fixed<<setprecision(2)<<x2<<endl; ^~~~ Main.cc:14:2: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'? Main.cc:14:69: error: 'endl' was not declared in this scope cout<<fixed<<setprecision(2)<<x1<<" "<<fixed<<setprecision(2)<<x2<<endl; ^~~~ Main.cc:14:69: note: 'std::endl' is defined in header '<ostream>'; did you forget to '#include <ostream>'? Main.cc:2:1: +#include <ostream> using namespace std; Main.cc:14:69: cout<<fixed<<setprecision(2)<<x1<<" "<<fixed<<setprecision(2)<<x2<<endl; ^~~~ */ |
Double click to view unformatted code.