By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,407 Members | 920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,407 IT Pros & Developers. It's quick & easy.

strings,structures,file handling in C language

P: 2
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),finds 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]
Nov 6 '06 #1
Share this Question
Share on Google+
5 Replies


sicarie
Expert Mod 2.5K+
P: 4,677
What's your question? Is there an error message you're having trouble with, or just getting started?
Nov 6 '06 #2

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

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),finds 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]
Nov 7 '06 #3

seeminsuleri
P: 9
hey wendy try this website.
http://www.java2s.com/Code/C/File/Writeoutfile.htm
it is very useful for the work you are tring to do.
Best Of Luck.

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),finds 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]
Nov 7 '06 #4

P: 2
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
Nov 7 '06 #5

sicarie
Expert Mod 2.5K+
P: 4,677
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(string)
declare studentRecord lnamestring(string)
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.
Nov 7 '06 #6

Post your reply

Sign in to post your reply or Sign up for a free account.