ive just started c++, n im not really good, even with the simple programs, couls someone help me with this?
Question 3 (10 marks)
• Static local variables
Implement a function to track various details regarding a list of exam results. Download
and extract prac6-q3.tar.gz and read the code in main.cpp to understand the simple control
flow. You are required to define the prototypes declared in marks.h. Do so in a file called
marks.cpp. Again write a makefile to automate the build. Your executable must be called
mark-stats in order for Fitchfork to evaluate your program.
Implement the functions according to the following specifications:
3.1 getMark() is to prompt the user to enter a mark as follows: (3)
>> Enter a mark (-1 to quit): <user input>
Return any input2 entered except if it is a mark of over 100.00. In such a situation
terminate as below:
>> Enter a mark (-1 to quit): 109
Invalid input! System aborting...
3.2 trackMarks() is to provide a running list of mark details by making use of static local (7)
variables. Each time the function is called, calculate and display the following details:
>> Enter a mark (-1 to quit): 67
** Mark Details
** Average: 67.00
** Highest: 67.00
** Lowest: 67.00
** Total Sum: 67.00
Technically speaking, any negative number will act as a sentinel in main.cpp, even though we only prompt
for -1. In this case it is a triviality, but it is important to be aware of such seemingly trivial details.
Page 7 of 9
COS 130/COS 132 Practical 6
** Sum of Squares: 4489.00
** Total Entries: 1
** First Entry: 67.00
** Last Entry: 67.00
Each time the function is called, your calculations must update the display accordingly.
For example, after the tenth call for an arbitrary set of inputs the display could look as
** Mark Details
** Average: 63.00
** Highest: 90.00
** Lowest: 35.00
** Total Sum: 630.00
** Sum of Squares: 42464.00
** Total Entries: 10
** First Entry: 67.00
** Last Entry: 70.00
Note that you need to format the output to display at 2 decimal places and ensure that
it is not in scientific notation. Also use stream manipulators to make the numbers right
justified such that they align uniformly on the decimal point.
Note that Total Sum refers to the sum of all entries while Sum of Squares refers to the
total sum of each entries’ square.
When your program is complete, compress marks.h, marks.cpp, main.cpp, input and
Makefile into a tarball and upload under Fitchfork assignment prac6-q3.

#include "marks.h"

int main() {
	float mark = 0.0;
	while (mark >= 0) {
		mark = getMark();
		if (mark >= 0.0)
	return 0;
// Header file for question 3.
// Define the following functions in a file called marks.cpp 
// according to the specifications in the question.

// Prompts for and gets a mark as input
// return:	The mark input
float getMark();

// Tracks various data as marks are input.
// mark	-	The most recent input
void trackMarks(float mark);
7 Years
Discussion Span
Last Post by emilo35

I'm not going to do your homework for you. If you make a serious attempt at this however, I will try to help you with debugging etc.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.