Hey guys, i am working on a project which basically takes a string which is being inputted by people and then adding it together and displaying in a certain format. What i am having problem is when i try to read the string and store it into the functions.
class Quarternoin
{
friend ostream& operator<<(ostream& , const Quarternoin&);
friend istream& operator>>(istream& ,Quarternoin& ) ;
public:
void Quarternoin (string) ;
void showSale();
private :
int value1a , value1b , value1c , value1d ;
int value2a , value2b , value2c , value3d;
string LineA;
string LineB;
};
ostream& operator<<(ostream &out , const Quarternoin &total ){
out << total.value1a << endl;
return out ;
}
istream& operator>>(istream &in , Quarternoin &total ){
cout << endl;
in >> total.LineA ;
return in;
}
void Quarternoin::Quarternoin(string c)
{
value1a = atoi (c.c_str());
}
int main()
{
Quarternoin A;
cout << "enter something : " ;
cin >> A ;
cout << A << endl;
return 0 ;
}
The problem i am facing is it seems whatever value i input into the program, it is not stored into A. Can sombody point out how am i able to fix this? Really hope for some help. This is the only part of the program left.