
but let's be serious here
here's a simple c++ application that does it
http://pastebin.com/m109fe83c
Code:
//This application will calculate the average of X numbers
//Header Files
#include <iostream> // So that we can input and output text
#include <iomanip> // So that we can manipulate the outputted text
#include <stdlib.h> // So that we can use cls to clear the screen
using namespace std;// So that we don't have to type std:: in front of commands such as cin and cout
void title()
{
cout << ":::::'###::::'##::::'##:'########:'########:::::'###:::::'######:::'########:::" << endl;
cout << "::::'## ##::: ##:::: ##: ##.....:: ##.... ##:::'## ##:::'##... ##:: ##.....::::" << endl;
cout << ":::'##:. ##:: ##:::: ##: ##::::::: ##:::: ##::'##:. ##:: ##:::..::: ##:::::::::" << endl;
cout << "::'##:::. ##: ##:::: ##: ######::: ########::'##:::. ##: ##::'####: ######:::::" << endl;
cout << ":: #########:. ##:: ##:: ##...:::: ##:. ##::: #########: ##::. ##:: ##...::::::" << endl;
cout << ":: ##.... ##::. ## ##::: ##::::::: ##::. ##:: ##.... ##: ##::: ##:: ##:::::::::" << endl;
cout << ":: ##:::: ##:::. ###:::: ########: ##:::. ##: ##:::: ##:. ######::: ########:::" << endl;
cout << "::..:::::..:::::...:::::........::..:::::..::..:::::..:::......::::........::::" << endl;
cout << endl;
cout << endl;
}
int main()
{
int mark;
double average;
int total = 0;
int count = 0;
int max;
char yn;
do
{
system("cls");
title();
cout << "How many numbers do you want in your average? ";
cin >> max;
cout << endl;
if (max < 1 || max > 100)
{
cout << "Your answer was either smaller than 1 or bigger than 100, program will now terminate" << endl;
return 0;
}
cout << "Please, enter " << max << " marks, and this application will calculate the average." << endl;
//Asks for a mark "max" times
for (count = 1; count <= max; count++)
{
cout << "Enter mark #" << count << " : ";
cin >> mark;
if (mark < 0 || mark > 100)
{
cout << "Invalid mark, please enter a mark between 0 and 100." << endl;
--count;
}
else
total = total + mark;
}
//Calculates the average
average = total / max;
//Displays the average of the 10 marks
cout << endl;
cout << endl;
cout << showpoint << setprecision(2) << fixed;
cout << "The average of the 10 marks is of " << average << " ." << endl;
cout << "Would you like to calculate another average? (y/n): ";
cin >> yn;
}
while (yn != 'n');
return 0;
}
i just made it real fast, what it does is that it asks for how many number you want in your average, and it loops the adding, at the end it divides by the ammount of numbers there was.
If you need more help, pm me
Bookmarks