Ok, here is a program....im getting an error, "est.cpp(1) : fatal error C1083: Cannot open include file: 'stream.h': No such file or directory
Error executing cl.exe."
I know something is wrong with the header...and i think it cannot read the cout (in bold). Im trying to run this in (Microsoft) Visual C++. Does it make a difference?? Can someone see where im making my mistake? Thank you again.
#include <sstream.h>
#include <string.h>
using namespace std;
bool StringToInt(const string &s, int &i);
int main(void)
{
string s1 = "12";
string s2 = "ZZZ";
int result;
if (StringToInt(s1, result))
{
[B]cout[/B] << "The string value is " << s1
<< " and the int value is " << result << endl;
}
else
{
cout << "Number conversion failed" <<endl;
}
if (StringToInt(s2, result))
{
cout << "The string value is " << s2
<< " and the int value is " << result << endl;
}
else
{
cout << "Number conversion failed on " <<s2 <<endl;
}
return(0);
}
bool StringToInt(const string &s, int &i)
{
istringstream myStream(s);
if (myStream>>i)
return true;
else
return false;
}
Thanks in advance.