P
PengYu.UT
Hi,
The following code would output "error". I don't understand why there
is such error. Could you please help me?
Thanks,
Peng
#include <string>
#include <sstream>
#include <iostream>
int main() {
double e, e1;
e = 10;
std:stringstream oss;
oss << e;
std::istringstream iss(oss.str());
iss >> e1;
e = 0;
oss.str("");
oss << e;
iss.str(oss.str());
if(!(iss >> e1))
std::cout << "error" << std::endl;
}
The following code would output "error". I don't understand why there
is such error. Could you please help me?
Thanks,
Peng
#include <string>
#include <sstream>
#include <iostream>
int main() {
double e, e1;
e = 10;
std:stringstream oss;
oss << e;
std::istringstream iss(oss.str());
iss >> e1;
e = 0;
oss.str("");
oss << e;
iss.str(oss.str());
if(!(iss >> e1))
std::cout << "error" << std::endl;
}