1. Create a file with the following data:
No of students on file – type integer
Then for each student
Student ID Number-type long
Student name- type integer[81]
Total credits- integer
Grade Point Average- float

Sample data:
3
0558899 Roger, R. 12 3.8
5646489 Jack, J. 24 2.5
1641564 John, B. 36 3.3
NOTE: THE STUDENTS NAME MUST HAVE NO EMBEDDED SPACES. WITH NO EMBEDDED SPACES YOU CAN READ THE NAME INTO AN ARRAY OF CHARACTERS USING THE EXTRACTION OPERATOR:
Char name[81];
Cin>>name;
2. Using the file you just created, write a C++ program that creates student reports for each student on the file as follows:
Student Name: Roger, R.
Student Id number: 0558899
Total Credits Grade Point Aversge Grade
12 3.8 B
The grade is computed as follows:
If the GPA is over 4.0 the student’s grade is A
If the GPA is less than 4.0 but grater ot equal to 3.0 the student’s grade is B
If the GPA is less than 3.0 but greater or equal to 2.0 the student’s grade is C
If the GPA is less than 2.0 but greater or equal to 1.0 the student’s grade is D
Otherwise the student grade is F

3. Redo part 2 and use SENTINEL -controlled loop instead of a count-controlled loop. To do this you must remove the “Number of Students on the file” data item(in the example ,3) and insert SENTINEL value at the end of the file.
4. Redo part2 and use an “end of file” loop. Be sure to remove the SENTINEL value added to the end of the file.

Recommended Answers

All 2 Replies

please help me with this program.....

the simplest place to start is just get the base program running.

#include <iostream>
int main()
{}

compile and run that. Then add no more than one function, loop, or control statement at a time and compile, run, test after each addition.

Since your file input is standardized you could use a series of calls using the >> operator rather than reading everything in as strings. Can't say that everyone would agree with that approach, but it's doable. In any event you'll want to declare a few variables, open the file and read some stuff in. Trying to read in the first line of the file is all you do at first. If you can successfully do that, then you can proceed to reading in the second line. If you can read in the first two lines, then try setting up loop to read in all line but the first. Keep building from there. Post pertinent code, problems, and error messages as they arise if you can't figure out what to do on your own.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.