Thread: Can someone please help me with my program? I am new to C programming.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    244

    Can someone please help me with my program? I am new to C programming.

    Hello,
    I was wondering if someone can help me with file input and output.
    I basically have golf.txt document that contains data from 8 golfers' scores while playing a game of golf. I used the data in the golf.txt document to create a program that read values from the .txt document and calculates the total score of each golfer. However, now i need to take it a step further and create a program that compares each golfers score to the par score and outputs a value for hole by hole.


    The program should output 18 different values for each golfer, where each value will contain (the number of tries- par score= score for that hole) and there are 18 holes in a game of golf so it make sense


    Each letter represents each golfers score on each hole. (A for hole 1, B for hole 2..... R for hole 18)

    It should look something like this for each golfer:
    Golfer #1’s score: A B C D E F G.....R
    Golfer #2.................
    Golfer #3..................




    This should not be too hard because I have it all the data I need in my golf.txt file:

    8 // This is the number of golfers
    4 4 3 5 4 3 4 5 6 5 4 4 4 5 5 4 3 3 // these are the par scores
    4 4 3 6 7 4 4 5 4 5 3 5 3 5 7 5 3 2 // for here down is each of the eight golfers score
    4 5 3 4 6 5 5 6 3 5 4 6 3 3 5 4 5 3
    3 4 5 6 4 4 4 5 5 5 4 5 4 3 3 5 4 3
    2 5 5 6 7 6 5 5 4 6 4 5 6 7 5 5 5 5
    4 5 6 3 3 5 4 4 3 3 2 5 6 6 5 5 3 3
    2 5 3 5 5 5 6 5 4 3 4 5 5 4 4 6 5 5
    6 5 4 5 5 3 5 6 5 4 6 5 6 4 4 6 5 4
    4 4 5 5 3 3 6 5 4 3 3 5 6 5 3 6 5 4




    MY QUESTIONS:

    1) Would arrays be the best way to go about completing this program?
    2) Would I need a 1d or 2d array to complete this program?
    3) If so, I am completely new to arrays! can anyone help me understand how I would set it up? I know that the basic format is something like int numbers [rows][columns]
    4) How would I add/ subtract array's positions from each other (for example row 2 column 3 + row 2 column 4) ?


    Thank You,
    Matt H.
    Last edited by matthayzon89; 02-27-2010 at 11:49 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM