my problem

This is a discussion on my problem within the C++ Programming forums, part of the General Programming Boards category; hi, i'm new to C programming and need a starting point for my problem. i've got a GIS data file ...

  1. #1
    GREGO33
    Guest

    Arrow my problem

    hi,
    i'm new to C programming and need a starting point for my problem.
    i've got a GIS data file containing a list of points(x and y value on each line, each go to 2 decimal points). i need to read the file and store it in buffer, then find max and min values of x and y.

    i don't know what to do!

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Read them as floats using cin. Read until EOF ( .eof() ) is encountered. Then do a for loop though the buffer looking for the max resp. the min value.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    GREGO33
    Guest

    Thumbs up

    ok thanks, but how do i distuinguish between the x and y values, they are separated by a space in the GIS file

  4. #4
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Code:
    float X;
    float Y;
    
    cin >> X >> Y;
    This will read two floats from the file, whether there are spaces or newlines inbetween.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  5. #5
    GREGO33
    Guest
    cheers, i'll give it a try!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 05:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 09:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM

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