There are 45 students in a class, and the averages of these students are kept in a "sequential process file". You are asked to write a program like this: When the program is run for the first time, it checks whether the "notes.txt" file exists, if there is no file, it creates the file and writes it in the form of "ID POINT" for 45 students with IDs from 1 to 45 and with score values of 0. So the initial state of the file will be as follows. 1 0 2 0 3 0 ... 44 0 45 0 If the file already exists, the existing file should be opened and the point values in the file should be used. The program will then receive the ID and SCORE from the user and change the grade given to the student with the relevant ID to the current average. If the ID is entered as 0, the program will terminate and the current average values will be written to the file. You can check if the file exists as follows. bool file_varmi(string filename){ Ifstream f(name) Return f.good() } Note: It is sufficient for each student to write their average against their ID number in the file. Hint: you can read the contents of the file with the help of an array and write the array back to the file. I want only C++ language
There are 45 students in a class, and the averages of these students are kept in a "sequential process file". You are asked to write a program like this:
When the program is run for the first time, it checks whether the "notes.txt" file exists, if there is no file, it creates the file and writes it in the form of "ID POINT" for 45 students with IDs from 1 to 45 and with score values of 0. So the initial state of the file will be as follows.
1 0
2 0
3 0
...
44 0
45 0
If the file already exists, the existing file should be opened and the point values in the file should be used. The program will then receive the ID and SCORE from the user and change the grade given to the student with the relevant ID to the current average. If the ID is entered as 0, the program will terminate and the current average values will be written to the file.
You can check if the file exists as follows.
bool file_varmi(string filename){
Ifstream f(name)
Return f.good()
}
Note: It is sufficient for each student to write their average against their ID number in the file.
Hint: you can read the contents of the file with the help of an array and write the array back to the file.
I want only C++ language
Step by step
Solved in 5 steps with 4 images