我有多项式课程。我还有一种方法可以将字符串转换为多项式。现在我尝试为输入运算符实现此方法:
istream& operator>> (istream &is, Poly& pol)
{
//the string that we use:
string str;
//the new input override the old:
pol.emptyPoly();
//getting a string from user and put it into str:
//?????????????????????
// convert the string to polynomial
pol.sToPol(str);
return is;
}
我需要输入什么//???????? 从用户那里获取字符串并将其放入 str 中?
那我什么时候做:
Poly p1;
cin>>p1;
用户将输入字符串,它将在我的方法中转换为多项式