Thread: Scanning for input; structures

  1. #1
    Registered User
    Join Date
    Nov 2012
    Location
    Montreal, QC
    Posts
    6

    Scanning for input; structures

    I need to write a function which reads two complex number from the user and stores it into the structure. How should I scan for input?
    Code:
    typedef struct{
    float real, imag;
    } complex_t;
    Code:
    complex_t read_complex(void)
    {
    
    }

  2. #2
    Registered User
    Join Date
    May 2012
    Posts
    1,066
    Usually, a complex number is written like a + bi.

    So why not use scanf() with an appropriate format string? What have you tried?

    Bye, Andreas

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help scanning input file into queue array
    By krazzyjman in forum C Programming
    Replies: 10
    Last Post: 11-01-2012, 06:25 PM
  2. Scanning input of different types
    By astalls769 in forum C Programming
    Replies: 1
    Last Post: 04-25-2012, 05:09 PM
  3. Scanning input data
    By papermate in forum C Programming
    Replies: 38
    Last Post: 04-25-2010, 01:56 AM
  4. Improper Scanning of Redirected Input
    By alexpos in forum C Programming
    Replies: 7
    Last Post: 10-21-2005, 01:21 PM
  5. input from text using structures
    By ehj3000 in forum C Programming
    Replies: 12
    Last Post: 09-16-2005, 10:30 PM