473,321 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Calculating Mean in C++

12
I need help with writing a program that can calculate the mean of 210 numbers but that will calculate the mean in fives, eg
0.55 0.64 0.60 0.86 0.76
0.44 0.54 0.48 0.74 0.67
1.69 6.39 6.33 4.72 2.66
39.92 50.28 55.13 54.19 45.28
4.23 12.70 11.48 8.71 5.87
88.12 52.58 40.18 38.71 54.55
so the program should calculate the first five= second five =....etc.
Feb 7 '07 #1
6 4658
Ganon11
3,652 Expert 2GB
Do you have the numbers in a file to be inputted? You can just read in 5 numbers to an array, find the average, output it (or process it in any other way your code demands), and repeat until you reach the end of the file.
Feb 7 '07 #2
kaygee
12
Do you have the numbers in a file to be inputted? You can just read in 5 numbers to an array, find the average, output it (or process it in any other way your code demands), and repeat until you reach the end of the file.
I have the numbers in a file ,but i dont know how to go about writing the program that will calculate the mean of the 5number to an array.
Feb 7 '07 #3
nickyeng
254 100+
u need a formula to calcuate the mean which i forgotten.

from
Nicky Eng
Feb 7 '07 #4
Ganon11
3,652 Expert 2GB
To find the average (mean) value of n number of values,

1) Add the values together.
2) Divide the sum by n to get the mean.

Just read in the values 5 at a time and compute their mean.
Feb 7 '07 #5
kaygee
12
To find the average (mean) value of n number of values,

1) Add the values together.
2) Divide the sum by n to get the mean.

Just read in the values 5 at a time and compute their mean.
I do know to do it but i do not know how to code it in c++
Feb 9 '07 #6
RedSon
5,000 Expert 4TB
I do know to do it but i do not know how to code it in c++
Start here: http://cplusplus.com/doc/tutorial/

When you run into troubles please feel free to post your problems.
Feb 9 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Joe Bongiardina | last post by:
What does the message "calculating...." mean in the lower left status area of a form? I have a form with no calculated, concatenated or lookup fields, yet it displays this msg. The form takes...
3
by: MS | last post by:
OK, calculating the mean from a set of numbers is easy. Anyone have formula for calculating the median? Ok, ok, I didn't do well at maths! :-(
2
by: Tim Marshall | last post by:
Wondering if anyone has any suggestions for this. Sometimes in the form reports my users run, a data sheet subform on a main form, with totals in text boxes with calculated controlsources...
3
by: Paul Aspinall | last post by:
Hi Can anyone recommend a suitable way of calculating distances between UK post codes?? Many websites do this, and I'm wondering if there is some standard code, and where the reference DB comes...
5
by: javaalien | last post by:
My lecturer has said that we do need to check our program and avoid from entering overflow calculating of looping..I really don't get it..what does it mean? If someone knows about it, please feel...
25
by: Umesh | last post by:
i want to calculate the time required to execute a program. Also i want to calcute the time remaining for the execution of the program. how can i do that? pl mention some good websites for...
8
by: brasilino | last post by:
Hi Folks: I'm trying to calculating a substring length directly from pointer address, like this: char *e = NULL, *s = NULL; int len = 0; s = strchr (url,'.'); e = strrchr (url,'?');
2
jkmyoung
by: jkmyoung | last post by:
Calculating Large Exponents Background: This is a quick article as to how to calculate the exponents of large numbers quickly and efficiently. Starting with a basic multiplication algorithm, it...
3
by: vj4u | last post by:
Hi im developing project on DataMining got stucked near calculating mean covariance and eigen value
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.