Problem 143

Grades in an Array and a File

Prompt the user for a first and last name, and the name for a file. Randomly choose five grades for that person from 1 to 100 and store them in an array that can hold five integers. Then output the first and last name and those five grades to the specified file.

Name (first last): Marc Antony
Filename: ettu.txt

Here are your randomly-selected grades (hope you pass):
Grade 1: 54
Grade 2: 90
Grade 3: 18
Grade 4: 37
Grade 5: 62

Data saved in "ettu.txt".

Later, if you look in ettu.txt (or whatever you called your file), you should see values like this:

Marc Antony
54 90 18 37 62

◄ 142: Copying Arrays 144: Finding a Value in an Array ►



Adapted from ProgrammingByDoing.com
©2013 Graham Mitchell

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.