I am trying to get my program to do some basic operations with 2 complex numbers, which user will enter. I am using complex.h. How can I use scanf() to scan for complex number(a+bi)?
Asked
Active
Viewed 873 times
1 Answers
0
scanf
has no format specifier for complex numbers, only for "more or less" primitive types http://www.cplusplus.com/reference/cstdio/scanf/. Easiest solution would be to read the real and imaginary part into two single floats/doubles and construct the complex number from your temporary values.

hakononakani
- 305
- 2
- 10