Saturday, April 17, 2010

Student record using c++???

I need a program that gets the data of 5 students and puts it in a record named "student" that contains: INT id, CHAR * name, FLOAT average..and then stores them in a file.the output of the program should be the list of the students.

Student record using c++???
I guess that's why you take the course.





You have to define a new type or class for your record format, create a small write function for it and finally call that function from main to write the 5 records.
Reply:Don't be lazy. Read your programming book and figure it out. In one file, write a class for the student record. Add a "toString" method that creates a string that has the student info. In another file, you'll need a loop in the main program that can iterate 5 times, each time creating a new student record. You can "get the data" using "cin" to read from the command line and put each item into the appropriate field of the data type. Open a file and write the record string out to it.


No comments:

Post a Comment