这是我的代码为我的运营商>>重载。它应该把数字分成一个分号并把它们放入一个bigint中。Bigint运营商>>超载
std::istream& operator>>(std::istream& is, bigint& bi) {
int i = 0;
char ch;
char temp[SIZE];
// grabs the first character in the file
is >> ch;
temp[i] = ch;
++i;
// while loop grabs the rest of the characters
// up to the semicolon
while(ch != ';') {
is >> ch;
temp[i] = ch;
++i;
}
// temp is stored in the bigint ref
bi = bigint(temp);
return is;
}
我遇到的问题是,当我运行它时,它给了我额外的输出。例如:当我输入“34”时作为输入,所得到的bigint将是“3411”。谁能告诉我我做错了什么?
[SSCCE](http://sscce.org)会有所帮助。 – chris