Hi I'm really new to c++ so please forgive me if this is really basic
but im stuck... I am trying to make a data class that uses
istringstram and overloaded << and >> operators to input and output
data. The data comes in string lines like "OREBlegQ 14854 731.818"
which need to be split into a string, int and double when stored in
the class. Can anyone help? This is what i have so far:
/* Begin Code */
#include <sstream>
using namespace std;
class lab2Data
{
public:
string *ID;
int inum;
double fnum;
lab2Data();
lab2Data( string *A, int B, double C );
friend ostream& operator<<(ostream& osObj, const lab2Data &data);
friend void operator<<(istringstream& isObj, const lab2Data &data);
};
lab2Data::lab2Data( string *A, int B, double C )
{
ID = A;
inum = B;
fnum = C;
};
lab2Data::lab2Data()
{
ID = 0;
inum = 0;
fnum = 0;
};
ostream& operator<<(ostream& osObj, const lab2Data &data)
{
osObj << data.ID << " " << data.inum << " " << data.fnum << "\n";
return osObj;
}
void operator<<(istringstream &isObj, lab2Data &data)
{
}
/* End Code */