-
Pointing !
Im doing this calulator app and I have a little problem with the parser..
the main function is calling the parser for each char entered..
when I was using cin.get(ch) everything was going perfectly...
But Now im trying to use istringstream instead.
But it keeps pointing at the same char?
why cin.getr will go to next char but ist.get(ch) wont?
Here is the stream that I use:
istringstream ist(temp_string);
ist.get(ch)
Or d/l the full code :
-
This worked corretly for me:
Code:
istringstream ist("Whats up dog!");
char ch;
while (ist.get(ch))
cout << ch;
gg
-
yeah that will work but since I call the function from main for each char it seems to forget where it was pointing at last time which didnt happen when I was using cin.get(ch)
-
The first question we ask in a code review is "Does your code compile?" It doesn't for me - the code you posted anyways.
gg
-
sorry was doing some test when I posted it and forgot some in it now its all right if u d/l again
Or just remove * before ist..
istringstream *ist(temp_string); // Oops!!
BTW: try to forget all the cout included... I used them for debugging..
I changed the attachement to remove them..
Luigi //sorry!