C++ Programing need help in writng the code ,,,,,
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: C++ Programing need help in writng the code ,,,,,

  1. #1
    Join Date
    Sep 2012
    Location
    Fiji
    Posts
    5

    C++ Programing need help in writng the code ,,,,,

    1. Declare three structs to store Athlete, Event and Registration details. The struct
    definitions are provided in Appendix 1.
    2. Write the driver code (main) and declare an array object of type Registration,
    assuming you can have a maximum of 20 registrations. Also, declare a pointer for
    this array object that you can use to access the array elements in your program.
    3. In the driver, write code to display a menu for the user with the following options.
    Each menu item may be selected by the user using the corresponding menu
    number. The menu should repeat after each selection until user enters 7 for exit.
    1
    2
    3
    4
    5
    – Read and display registration file
    – List all athletes by event
    – List all athletes by country
    – Read and display result file
    – List medal counts by country
    CS112 Assignment 1, 2012
    1

    6
    7
    – Display medal tally
    – Exit
    Implement each of the above menu options (1-6) in separate functions that you can call from your driver program. Below are the descriptions for each function, with the function prototypes given in Appendix 1 as a guide.
    1 - The registration.txt file contains the registration ID, athlete and event details for each participating athlete. The function takes the registration array pointer (declared in step 2) as an input parameter, together with an integer size (passed as reference and used to count the number of records read in the array). The function should first ask the user to enter the complete path and filename for the input file (example C:\\registration.txt), which is read and stored in the registration array using the pointer. The function should then display the contents of the input file as read in the registration array.
    2 - The function takes the registration array pointer, size and an event ID (which is entered by the user within the driver) as inputs and displays the athlete ID, name and country of all athletes registered for that event.
    3 - The function takes the registration array pointer, size and a country name (which is entered by the user within the driver) as inputs and displays the athlete ID, name and event name for all athletes representing that country.
    4 - The results.txt file contains the event ID and top three athlete IDs (representing gold, silver and bronze winners for that event). Assume there are no ties, no multiple medal winners and the input file can contain a maximum of 20 records (results) at a time. In your driver, declare a 2-D integer array (size 20x4) that can store the contents of the input file. The function should then take this 2-D array and an integer size (passed as reference and used to count the number of records read in the array) as inputs. It should first ask user to enter the complete path and filename for the input file (example C:\\result.txt), which is read and stored in the 2-D array appropriately. The function should then display the contents of the input file as read in the array.
    5 - The function takes the registration array pointer, size, 2-D array, size and a country name (which is entered by the user within the driver) as inputs and displays the country name and the total number of gold, silver and bronze medals won by that country.
    6 - The function takes the registration array pointer, size, 2-D array and size as inputs and lists all countries who have won a medal and display the total count of gold, silver and bronze medals for each country in some appropriate format (it is not necessary to rank or sort the countries in any particular order).



    Appendix 1
    Struct Definitions
    struct Athlete struct Event struct Registration
    { { {
    int aID; int eID; int rID;
    string aName; string eName; Athlete rAthlete;
    int aAge; string eRecord; Event rEvent;
    char aGender; }; };
    string aCountry;
    };
    Function Prototypes
    1. void ReadRegistrations (Registration *regPtr, int &size);
    2. void ListAthletesByEvent (Registration *regPtr, int size, int eID);
    3. void ListAthletesByCountry (Registration *regPtr, int size, string country);
    4. void ReadResults (int results[ ][4], int &size);
    5. void ListMedalsByCountry (Registration *regPtr, int size1, results[ ][4], int size2, string country);
    6. void ListMedalTally (Registration *regPtr, int size1, results[ ][4], int size2);
    Appendix 2 – Input Files (available on Moodle)
    registration.txt
    result.txt
    result.txt
    Appendix 3 – Sample Output
    RID AID AName AAge AGender ACountry EID EName ERecord
    101 201 tony 28 m fiji 301 200m 20s
    102 202 anna 30 f samoa 305 shotput 25m
    103 201 tony 28 m fiji 302 400m 54s
    104 203 pita 21 m vanuatu 301 200m 20s
    105 203 pita 21 m vanuatu 304 discus 80m
    106 204 sam 22 m tonga 301 200m 20s
    107 205 lisa 28 f kiribati 305 shotput 25m
    108 206 mere 32 f fiji 305 shotput 25m
    109 207 kenny 29 f samoa 308 1500m 5m
    110 208 raj 40 m fiji 310 200m 20s
    EID AID1 AID2 AID3







    Appendix 3 – Sample Output
    Welcome to Athlete Registration and Result Program
    Menu:
    1 – Read and display registration file
    2 – List all athletes by event
    3 – List all athletes by country
    4 – Read and display result file
    5 – List medal counts by country
    6 – Display medal tally
    7 – Exit
    Enter menu option: 1
    Enter registration filename: C:\\registration.txt
    RID AID AName AAge AGender ACountry EID EName ERecord
    101 201 tony 28 m fiji 301 200m 20s
    102 202 anna 30 f samoa 305 shotput 25m
    103 201 tony 28 m fiji 302 400m 54s
    104 203 pita 21 m vanuatu 301 200m 20s
    105 203 pita 21 m vanuatu 304 discus 80m
    106 204 sam 22 m tonga 301 200m 20s
    107 205 lisa 28 f kiribati 305 shotput 25m
    108 206 mere 32 f fiji 305 shotput 25m
    109 207 kenny 29 f samoa 308 1500m 5m
    110 208 raj 40 m fiji 310 200m 20s
    Menu:
    1 – Read and display registration file
    2 – List all athletes by event
    3 – List all athletes by country
    4 – Read and display result file
    5 – List medal counts by country
    6 – Display medal tally
    7 – Exit
    Enter menu option: 2
    Enter event ID: 305
    AID Name Country
    202 anna samoa
    205 lisa kiribati
    206 mere fiji
    Menu:
    1 – Read and display registration file
    2 – List all athletes by event
    3 – List all athletes by country
    4 – Read and display result file
    5 – List medal counts by country
    6 – Display medal tally
    7 – Exit


    Menu:
    1 – Read and display registration file
    2 – List all athletes by event
    3 – List all athletes by country
    4 – Read and display result file
    5 – List medal counts by country
    6 – Display medal tally
    7 – Exit
    Enter menu option: 7
    Press any key to continue…

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: C++ Programing need help in writng the code ,,,,,


  3. #3
    Join Date
    Sep 2012
    Location
    Fiji
    Posts
    5

    Re: C++ Programing need help in writng the code ,,,,,

    hey i really need help,,,,,i dont understand this topic

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,101

    Re: C++ Programing need help in writng the code ,,,,,

    I repeat :

    Quote Originally Posted by HanneSThEGreaT
    Hmm, this is homework. Usually people tend not to help with homework assignments if an effort has not been made by you. Show us what coding you have done, and show us your errors. Then, we could help.
    OK, let me explain this nicely.
    This is your second topic concerning homework. Skizmo, as well as myself has explained nicely to you that you need to make an effort as well.

    We are all here in our personal capacities. It is not our paying job to answer questions all day. We have work. And when and if we have spare time, we sacrifice that time to help people.

    We cannot do everything for you. I had to work extremely hard to get to where I am, and I suppose the same is true with Skizmo and many other members here. With our experience and knowledge we have gained throughout the years, we are able to help.

    It is unfair to demand help blatantly without doing anything.

    If it is homework. Your passing grade will mean nothing. If it is for your work, you will end up getting paid, without doing anything. Sorry, but the real world does not work like that.

    I know I'll probably be scolded after this post, but I am trying to help you. I am willing to help you. But, if you do not want to help yourself - that is your problem.

    As a moderator, I will ask you the following :

    Please provide some code of what you have attempted, and highlight the errors for us, so that it is easier and possible for us to help you. If you are going to keep on demanding as in Post #3, I'll have to close your threads or take action - which I really do not want to do, because CG is a very kind peaceful place.

    Hannes

  5. #5
    Join Date
    Sep 2012
    Location
    Fiji
    Posts
    5

    Re: C++ Programing need help in writng the code ,,,,,

    ok

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,231

    Re: C++ Programing need help in writng the code ,,,,,

    I bill out at $1500 a day, three days minimum. Please contact me ASAP to make arrangements for payment so I can get started for you.

  7. #7
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,101

    Re: C++ Programing need help in writng the code ,,,,,

    Quote Originally Posted by GCDEF View Post
    I bill out at $1500 a day, three days minimum. Please contact me ASAP to make arrangements for payment so I can get started for you.
    No offense but this is a tad uncalled for at this stage

    Let us all just wait for the OP to respond, else we'll end up with a huge thread, that means nothing. I do not want to end up closing this thread / removing this thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center