I need to convert a string in the a ± bi
form to an int Real
and an int Im
. And in the case that the string isn't in that form, print an error. I have an idea to convert the a
to the int and also the b
but I don't know what to do with de imaginary number if it is positive.
i.e.
0,034 - 1,2i
>a=0,034
>b=-1,2
0,25
>Error, you must write in "a±bi" form
3,234 + 34,43i
>a=3,234
>b=34,43
ps: I found this link but it is in C++ and I don't know what it is doing
EDIT: THE REAL NUMBER COULD HAVE A PLUS OR MINUS.