Escolar Documentos
Profissional Documentos
Cultura Documentos
5.0
10.0
6.3
The second loop of the program should loop over all the radii stored in the array and process
them in the same manner as we have up to now. But please follow these rules:
Make sure you use 2 loops for the program the first for reading and storing input and
the second for processing the array.
Make sure the first loop is open ended meaning it will loop until all the input is read from
the input file.
Make sure the second loop only runs over the number of elements actually stored in the
array. That means if we only use 3 elements of the 10 element array, the second loop
should only loop 3 times.
When you open the input file make sure you check that the file opened correctly and the stream
point is properly created. You might use a statement like the following to accomplish this:
if ((spInput = fopen("input.txt", "r") == NULL
printf("Could not open input file!\n");
Also notice that we are opening this file in read mode ("r").
Continue using the if else statement from your last assignment inside the loop. However
generalize the statement so that it will work for all radii. It should have the following form:
Please note you will only need to include one such if statement because it is generalized
to work for all loops.
The output should have the following format:
Circle 1 radius:
###.##
Circle 1 circumference: ###.##
Circle 1 area:
###.##
Circle 2 radius:
###.##
Circle 2 circumference: ###.##
Circle 2 area:
###.##
Circle 3 radius:
###.##
Circle 3 circumference: ###.##
Circle 3 area:
###.##
Dont forget the following program head for all programs submitted for grading.
// Program Author:
// Student ID:
// Email Address:
// Name of Program:
// Program Due Date:
// Objective:
assignment
// Program Description:
// Honor Code:
//
else's
//
Your name
xx000012345
xx@ltu.edu
Name of Program.c
MM-DD-YY
The Instructors description of the programming
The Students description of how the program works
I have neither given nor received unauthorized aid in
completing this work, nor have I presented someone
work as my own!
You can submit this program to me as a hardcopy in class (preferred option) or in the digital drop
box. But please remember it is due by Tuesday Oct. 24. I will check dates in the digital drop box
to make sure it was submitted on time.
Enjoy!