strings,structures,file handling in C language

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wendyzhakata
    New Member
    • Nov 2006
    • 2

    strings,structures,file handling in C language

    you are required to keep tailoring records of fellow students in your class. each record is made up of the following fields:
    (a)Fname: a character array of maximum15 characters representing the first name of the student
    (b)Sname: a character array of maximum 18 characters representing the surname of the student
    (c)Dob: a character array entered as dd/mm/yyyy representing the date of birth of the student
    (d)Height: a float representing the student's height in metres
    (i)define an appropriate structure to store a single record[8]
    (ii)define an array caled all_records for storing 7 records[2]
    (iii)define a function called enter_record() that allows a user to input a full single record, and assigns the value to the next empty slot in the array all_records[8]
    (iv)define a function printf() that prints out all non-empty records in the array all_records[8]
    (v)write a function that extracts the date of births of all non-empty records and prints out the names and corresponding date of birth of each record to the screen[10]
    (vi)write a function that converts the height to an integer(hence the height is now in centimetres),fi nds the average height of all the students and prints the result to the screen[10]
    (vii)write a main function to complete your program and test that your functions work[10]
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    What's your question? Is there an error message you're having trouble with, or just getting started?

    Comment

    • seeminsuleri
      New Member
      • Nov 2006
      • 9

      #3
      hey there,
      its a lengthy assignment. Why dont u mention what parts u would like to get help in :)

      Originally posted by wendyzhakata
      you are required to keep tailoring records of fellow students in your class. each record is made up of the following fields:
      (a)Fname: a character array of maximum15 characters representing the first name of the student
      (b)Sname: a character array of maximum 18 characters representing the surname of the student
      (c)Dob: a character array entered as dd/mm/yyyy representing the date of birth of the student
      (d)Height: a float representing the student's height in metres
      (i)define an appropriate structure to store a single record[8]
      (ii)define an array caled all_records for storing 7 records[2]
      (iii)define a function called enter_record() that allows a user to input a full single record, and assigns the value to the next empty slot in the array all_records[8]
      (iv)define a function printf() that prints out all non-empty records in the array all_records[8]
      (v)write a function that extracts the date of births of all non-empty records and prints out the names and corresponding date of birth of each record to the screen[10]
      (vi)write a function that converts the height to an integer(hence the height is now in centimetres),fi nds the average height of all the students and prints the result to the screen[10]
      (vii)write a main function to complete your program and test that your functions work[10]

      Comment

      • seeminsuleri
        New Member
        • Nov 2006
        • 9

        #4
        hey wendy try this website.

        it is very useful for the work you are tring to do.
        Best Of Luck.

        Originally posted by wendyzhakata
        you are required to keep tailoring records of fellow students in your class. each record is made up of the following fields:
        (a)Fname: a character array of maximum15 characters representing the first name of the student
        (b)Sname: a character array of maximum 18 characters representing the surname of the student
        (c)Dob: a character array entered as dd/mm/yyyy representing the date of birth of the student
        (d)Height: a float representing the student's height in metres
        (i)define an appropriate structure to store a single record[8]
        (ii)define an array caled all_records for storing 7 records[2]
        (iii)define a function called enter_record() that allows a user to input a full single record, and assigns the value to the next empty slot in the array all_records[8]
        (iv)define a function printf() that prints out all non-empty records in the array all_records[8]
        (v)write a function that extracts the date of births of all non-empty records and prints out the names and corresponding date of birth of each record to the screen[10]
        (vi)write a function that converts the height to an integer(hence the height is now in centimetres),fi nds the average height of all the students and prints the result to the screen[10]
        (vii)write a main function to complete your program and test that your functions work[10]

        Comment

        • wendyzhakata
          New Member
          • Nov 2006
          • 2

          #5
          Originally posted by sicarie
          What's your question? Is there an error message you're having trouble with, or just getting started?
          just getting started. dont even know how to write the program

          Comment

          • sicarie
            Recognized Expert Specialist
            • Nov 2006
            • 4677

            #6
            Well, the first thing you should do when you're having trouble starting an assignment is simply define what you want to do, in one phrase.

            Keep track of student records

            From there, you break it down into smaller and smaller tasks (create student records, delete student records, print student records, etc...) until you have basic, logical, fragments

            declare studentRecord fnamestring(str ing)
            declare studentRecord lnamestring(str ing)
            declare studentRecord height(float)
            declare studentRecord dob(char[])
            create studentRecord1 (StudentRecord studentRecord1 = new StudentRecord() depending on c/c++, that's just a logical representation)
            initialize fname to classmate's name
            initiliaze lname to classmate's name
            intialize height to classmate's height
            print studentRecord1. fname
            ...
            create studentRecord2
            initialize....
            etc....

            and do so in an order that will fulfill all the points of your requirements. To be able to better logically understand your program, I would move a-h right below i, as i will encompass all of them. That is your pseudocode, and from there, the site that seeminsuleri gave you should tell you almost everything you needed to know about the syntax of what you are doing (and if you did your pseudocode, it should be much easier).

            Try that and see what you get, if you need any more help, feel free to ask.

            Comment

            Working...