Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C or C++ program that reads a file (students.txt) which contains names o

ID: 3842287 • Letter: W

Question

Write a C or C++ program that reads a file (students.txt) which contains names of students. It then creates a linked list of students. Each entry in the list must contain the student name, the final average, and a pointer to the next student record. The program initializes the list by first reading the students’ names from the text file and setting the final grades to 0.00. After building the list, the program then loops through it and prompts the user to enter the final average for each student. Finally, the program then writes all the information to another file (output.txt).

Explanation / Answer

#include struct student { char name[50]; int roll; float marks; } s; int main() { printf("Enter information: "); printf("Enter name: "); scanf("%s", s.name); printf("Enter roll number: "); scanf("%d", &s.roll); printf("Enter marks: "); scanf("%f", &s.marks); printf("Displaying Information: "); printf("Name: "); puts(s.name); printf("Roll number: %d ",s.roll); printf("Marks: %.1f ", s.marks); return 0; }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote