Thread: my problem

  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, 04: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, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM