Jan 20, 2013 at 11:44pm UTC
my header file.
#ifndef QUADTRATICEXPRESSION_H
#define QUADRATICEXPRESSION_H
#include <string>
class quadraticExpression
{
public:
quadraticExpression (double = 0, double= 0, double =0);
void setA (double);
void setB (double);
void setC (double);
double evaluate (double x) const;
string getNumberOfRoots();
private:
double a;
double b;
double c;
};
#endif
MY CPP FILE
#include "quadraticExpression.h" // tie the files together
#include <stdexcept>
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string>
//iostream is for cin cout
using namespace std;
string quadraticExpression::getNumberOfRoots()
{
const string noOfRoots;
return noOfRoots;
}
i am getting an error msg saying that i cannot use a string for return type in member function. I need to return something to the source like "infinite roots" or "one root" or "two roots". How do i get through this, please help thanks.
Jan 20, 2013 at 11:49pm UTC
Could you show the exact error message instead of your interpretations next time?!
In the header file you did not include the derictive
using namespace std;