Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
I need help with this C++ code.?
Write a program to complete the following tasks.
(1) Record students' grades in a data file. Prompt users for the file name of data file; id, name and grade of each student as well as the total number of students. Following shows an example of outputs in data file and console.
ID NAME GRADE
01 Mary 100.00
02 Tom 98.35
03 John 88.99
......
(2) If grade is <0 or >100, ask users to re-enter correct grade.
(3) After generating data file, read the content of data file and print to console.
3 Answers
- LOLOLOLOLLv 48 years agoFavorite Answer
You should do your own homework -_- how do you expect to learn if you ask for other people's work? ><
- 8 years ago
You didn't really ask a specific question. I won't write out the whole thing for you, but i'll give you a few pointers.
(1) You'll need a series of cin and cout statements to record the information. It sounds like you are working with classes. So you'll need to declare a class named Students. And create the functions it will need. You will also need a loop to traverse each separate student created with the Student class.
(2) You will have needed to record the grade with an int variable. You'll need a if statement.
if(grade<0 || grade>100)
{
cout<< "Please reenter grade /n"
}
(3) You'll need to write out every class into a data file by declaring an out stream. You'll need to write the contents of the data in the classes into the stream.
I hope this helps. I'm a third year CS major, and honestly doing it yourself is the best help I can give you.
Source(s): Myself. - Anonymous8 years ago
Sorry dude, that's not asking for help.