Structure & File IO Problems
Structure & File IO Problems
1. Suppose there are 'n' students enrolled in a course. (n= user input)
i. Take all the students name and ids as input using structures, and sort
the info alphabetically by their names. Then print out the sorted info.
ii. In the structure used in i. , add a member that will take quiz marks of 3
quizzes. Find the average of these marks for each student. Add another
member called merit that will define each students position according to
their average marks, and then print the students name, id and merit
position from 1st to last.
iii. Do the same using files as input & output.
i. Implement a function to print out the names of all the customers with
balance under $100.
ii. Implement a function to add $100 to all the customers having balance
above $500, and then print their incremented balance.
7. Create a C program to read a day (suppose your birthday) from a file. Using
structures, calculate your age and store your age (Years, months, days) in
another file.
8. Create a C program that generates five random marks, stores them in a file,
reads the marks from the file, finds the lowest mark, and replaces it with "0"
9. Write a C program that can create a file as "Exercise.txt" which contains the
following sentence: “In our programming class, we save our files in .c format.“
The program then reads the sentence from the file and prints the sentence
replacing the .c with .py like this: “In our programming class, we save our files
in .py format.”
10. Write a c program to print the source code of the same program using File IO.