Thread: problem on File in C programming

  1. #1
    Registered User
    Join Date
    Mar 2016
    Posts
    1

    problem on File in C programming

    latitude : 17.442666666666664
    longitude : 78.479667666666671
    info: Speed = 0.08890

    latitude : 17.442742166666669
    longitude : 78.479816333333332
    info: Speed = 0.08704

    latitude : -17.442776666666667
    longitude : -78.479719333333335
    info: Speed = 0.08890

    latitude : 17.445506166666668
    longitude : 78.481523333333342
    info: Speed = 0.01852

    latitude : 17.445666000000003
    longitude : 78.481516666666664
    info: Speed = 0.01852

    latitude : 17.445611166666666
    longitude : 78.481519833333337
    info: Speed = 0.01852

    latitude : 17.445518499999999
    longitude : 78.481500000000011
    info: Speed = 0.01667

    latitude : 17.445383333333332
    longitude : 78.480018500000000
    info: Speed = 0.01667

    latitude : 17.445209333333331
    longitude : 78.481665166666673
    info: Speed = 0.01667

    latitude : 17.445500166666665
    longitude : 78.480185166666658
    info: Speed = 0.01667

    This is my input of output.text file. How can I take average of five latitude and 5 longitude value and same process will be continues for next latitude and longitude values? Please help me.

  2. #2
    Registered User
    Join Date
    Sep 2010
    Location
    Europe
    Posts
    87
    I would read the file line by line, parse the strings and convert the desired ones from a string to a double and then compute the ar. mean.

    Alternatively you can simply copypaste it and compute it in a notepad without any use of programming

    Are you sure the values in the third items are negative?
    Last edited by nerio; 03-29-2016 at 05:00 AM.

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    Do you have any thoughts on how you can accomplish this? Come up with a general "big-picture" idea first, then start refining it into steps until you come up with the necessary pseudo-code. If you get stuck along the way, tell us where and how you're stuck and we can offer more specific advice.

    Some words to consider: "read", "store", "count".

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [HELP] About FILE I/O programming
    By KI Won Kim in forum C Programming
    Replies: 4
    Last Post: 03-15-2016, 01:14 PM
  2. Need help with file in C programming
    By Nhân Trần in forum C Programming
    Replies: 5
    Last Post: 09-18-2015, 04:19 AM
  3. C Programming. File INPUT OUTPUT problem. HELP
    By gnomelook in forum C Programming
    Replies: 3
    Last Post: 02-23-2012, 05:33 PM
  4. Linux programming problem Bad file discriptor
    By thlgood in forum C Programming
    Replies: 2
    Last Post: 11-06-2011, 05:19 PM
  5. Replies: 3
    Last Post: 10-31-2011, 04:33 AM