Scanning for input; structures

This is a discussion on Scanning for input; structures within the C Programming forums, part of the General Programming Boards category; I need to write a function which reads two complex number from the user and stores it into the structure. ...

  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, 07:25 PM
  2. Scanning input of different types
    By astalls769 in forum C Programming
    Replies: 1
    Last Post: 04-25-2012, 06:09 PM
  3. Scanning input data
    By papermate in forum C Programming
    Replies: 38
    Last Post: 04-25-2010, 02:56 AM
  4. Improper Scanning of Redirected Input
    By alexpos in forum C Programming
    Replies: 7
    Last Post: 10-21-2005, 02:21 PM
  5. input from text using structures
    By ehj3000 in forum C Programming
    Replies: 12
    Last Post: 09-16-2005, 11:30 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21