I want to write program witch Class, that contains some vector. I overloaded ">>" operator and I want to put values typing them in one line, like this
1 2 3 4
This is my function
istream &operator>>(istream &in, Wielomian &w){
double val;
w.stopien=0;
while(in>>val){
w.tabw.push_back(val);
w.stopien++;
}
return in;
};
I don't know what I'm doing wrong, this function wont finish while loop. This is my class
class Wielomian{
private:
int stopien;
vector<double> tabw;
public:
Wielomian(){
stopien=0;
}
Wielomian(int s, vector<double> t){
tabw=t;
stopien=s;
}
Wielomian(Wielomian &w){
this->stopien=w.stopien;
this->tabw=w.tabw;
}
friend istream &operator>>(istream &in, Wielomian &w);
friend ostream &operator<<(ostream &out, const Wielomian &w);
};
Thank you for any advice.