I'm a new c++ learner.Now,I have a problem in my code, but I don't know how to debug it.Please help me.It's form.h file.
using namespace std;
class Form
{
friend ostream& operator << (ostream&, const Form&);
int prc;
int wdt;
int fmt;
double val;
public:
explicit Form(int p=6):prc(p)
{
fmt = 0;
wdt = 0;
}
//Bound_form operator()(double d) const;
Form& scientific()
{
fmt = ios_base::scientific;
return *this;
}
Form& precision(int p)
{
prc = p;
return *this;
}
Form& fill(char);
std::ostream& operator<<(std::ostream& os, const Form& bf)
{
ostringstream s;
s.precision(bf.prc);
s.setf(static_cast<ios_base::fmtflags>(bf.fmt), ios_base::floatfield);
s.setf(bf.fmt,ios_base::floatfield);
s << bf.val;
return os << s.str() ;
}
};
When i compile, it says: enter image description here
Aucun commentaire:
Enregistrer un commentaire