So I am trying to read a list of complex numbers from a txt file given as:
3+5i
2-3i
11+22i
However when i use stringstream(oneline)>>real>>plusorminus>>im>>ichar; the real part is okay but the im part always shows up as 0. I tried to debug it by adding the cout<<im and no matter what i tried im always showed up as zero. Please and thank you for your help.
so on line 8 i want to read in the parts of the file separately for example for the first line in the txt file 3+5i, I want real= 3, plusorminus=+ , im=5 and ichar=i.
To verify this i put cout<<real on line 9 and it works fine. the plusorminus is also fine but when i put the I'm it always equals 0 when it should equal 5 in this case. Hope that makes it a little more clear.
I understand your problem, but I cannot reproduce it.
Your snip is incomplete, so I added things to make it compile, and it worked fine in my machine. So I guess that you did something different, and that's why I'm asking you to post enough code so we can compile, run and get the same errors (or equivalent) that you do.