Documente Academic
Documente Profesional
Documente Cultură
=
=
=
=
=
=
'R';
'A';
'D';
'I';
'U';
'S';
subStr++;
subStr++;
subStr++;
subStr++;
subStr++;
The five elements in formats should be each of the five different format strings used in the
printf() function calls in calcAndPrint(). These strings should be defined in the main
function like this:
// Create the format
formats[0] = "Circle
formats[1] = "Circle
formats[2] = "Circle
formats[3] = "Circle
formats[4] = "Circle
strings.
%d radius:
%d circum:
%d area:
%d circum:
%d area:
\t\t%6.2f\n";
\t\t%6.2f\n";
\t\t%6.2f\n\n";
\t\tNot Calculated\n";
\t\tNot Calculated\n\n
Once these character strings are created and stored in formats, calcAndPrint() can be
called with the three input parameters like this:
calcAndPrint(3, radii, formats);
Inside calcAndPrint(), the printf() calls should now use the entries in formats for the format
strings rather than string literals. Below is an example of how the printf() call to print a circle
radius would look:
// Calculate and print circumf and area for the circle.
printf(formats[0], loop_counter+1, radii[loop_counter]);
You can use the input file you used for assignment 6. It should have the structure below:
1
2
3
5.0
10.0
6.3
The output should have the following format (Please note the capital letters!):
Circle 1 RADIUS:
Circle 1 CIRCUM:
Circle 1 AREA:
###.##
###.##
Not Calculated
Circle 2 RADIUS:
Circle 2 CIRCUM:
Circle 2 AREA:
###.##
Not Calculated
###.##
Circle 3 RADIUS:
Circle 3 CIRCUM:
Circle 3 AREA:
###.##
Not Calculated
Not Calculated
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
//
Enjoy!
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!