Lab
8
Write a program to read real-valued grades
from a file whose name is "Grades.txt". Your program is supposed to count
how many grades are greater than 50 and display that. It's supposed also
to count the number of grades in the file. Before you run the program,
create a file using an editor. Name the file "Grades.txt" and write
several real-values grades in the file. Separate the grades by either
space or new line. File "Grades.txt" should be first in the same directory
as your program. Then move the file to drive A and modify your program
accordingly.
Repeat number 1, but this time the name of the file should be entered
by the user.
Write a program to read real-valued grades from a file whose name is
"Grades.txt". Your program is supposed to ask the user to enter a grade,
call it G, and then to search "Grades.txt" (the name should be entered by
the user) for G. If G is in the file display "Found". If G is not in the
file, display "Not Found". Before you run the program, create a file
using an editor. Name the file "Grades.txt" and write several real-values
grades in the file. Separate the grades by either space or new line. File
"Grades.txt" should be in the same directory as your program.
Write a program to read a file whose name is entered by the user. The
file contains floating-point numbers separated either by space or by new
lines. The program should calculate the average of the numbers in the file
and write that to a file whose name is entered by the user.
An input file has the following description: Each line contains a SSN
of a student (the SSN is in them form DDD-DD-DDDD, where D is a digit
(0..9)) followed by an integer grade. Write a program to ask the user to
enter a name of an input file of the previous description. Find the
student/students who have the highest grade and write that to an output
file whose name is entered by the user.