Display it on the screen

hey ive got this code which calculates pollution for 6days and then shows the average entered by the user e.g. if i enter 40,50,40,50,40,50 it will calculate and show me the average which is 45

now i want to write a function to the program to show me it on the screen e.g.

The pollution level for the 6days was : 45
40
50
40
50
40
50

heres the code.... ANY HELP!!! PLEASEE :(

#include "stdafx.h"
#include "gwin.h"

const int MAXDAYS=6;

// function declaration
int GetValidPollution(int Day, GWindow& window);

void DrawHistogram(int level[], int count, GWindow& window);

int main()
{
GWindow Gwin;
int pollution_level[MAXDAYS];
double average=0.0;
int counter =0;

while (counter<MAXDAYS)
{
pollution_level[counter] = GetValidPollution(counter, Gwin);
average = average + pollution_level[counter];
counter++;
}
//DrawHistogram(pollution_level, MAXDAYS,Gwin);
Gwin.setPenColour(BLACK);
Gwin.writeText(10, 50, "The average pollution level over those 6 days was :");
Gwin.writeDouble(10, 70,average/MAXDAYS);


// Finally, wait for a key to be pressed
Keyboard.waitKey();

return 0;
}

//function definition
int GetValidPollution(int Day, GWindow& window)

{
int FailCounter=0;
int testvalue=0;
window.clear();
window.setPenColour(BLACK);
window.writeText(0,20,"Enter pollution level for day ");
window.writeInt(190,20,Day);
window.writeText(200,20," range (1-100): ");
testvalue = window.readInt();
while ((testvalue<1)||(testvalue>100))
{
window.clear();
window.setPenColour(RED);
FailCounter++;

if (FailCounter==1)
{
window.writeText(0,50, "Number is incorrect Enter between 1 and 100");
}
if (FailCounter==2)
{
window.writeText(0,50, "ENTER BETWEEN 1 AND 100");
}
if (FailCounter>=3)
{
window.writeText(0,50, "GO AWAY!!");
}



window.writeText(0,20,"Enter pollution level for day ");
window.writeInt(190,20,Day);
window.writeText(200,20," range (1-100): ");
testvalue = window.readInt();
}

return testvalue;
}

Topic archived. No new replies allowed.