Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 07:34

  • Please register to post and access all features, it's quick, easy and FREE!


Calculating the Average of Numbers

Reply
 
Old   #1
 
elite*gold: 26
Join Date: Sep 2012
Posts: 2,499
Received Thanks: 171
Calculating the Average of Numbers

Hello Guys,

can someone explain how i calculate the average of numbers entered by the user with a dynamic array?

I am really bad in programming so it would be nice if
someone could help me..



KeinDing. is offline  
Old 10/30/2018, 00:39   #2
 
elite*gold: 0
Join Date: Apr 2008
Posts: 504
Received Thanks: 623
C
  1. the user how many values he's going to enter
  2. Allocate some memory using
  3. from the user and store the values inside the allocated memory
  4. Iterate through the list
  5. Sum up all values and divide them by the number of values

C++
  1. Read in the numbers from the user and store them in a or a
  2. through all values of the vector or list
  3. Sum all values up and divide them by the number of values


florian0 is offline  
Old 10/30/2018, 14:22   #3
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,067
Received Thanks: 501
Quote:
Originally Posted by florian0 View Post
Allocate some memory using malloc
what a normie, cool kids use so you don't have to free up the memory
warfley is offline  
Reply



« CSV datei als array auslesen | Arduino Nano LED Würfel »

Similar Threads
[Selling] account lvl 30 / average 25000 pi / average 140 rp
01/23/2015 - League of Legends Trading - 0 Replies
Hi everybody i got regularly some fresh lvl 30 account to sell , 20 euros per account . Have a nice day .
charname numbers or guild numbers will take block?
02/21/2010 - SRO Foreign - Discussions / Questions - 6 Replies
charname numbers or guild numbers will take block? some friends said that to me is it right?
Calculating Eudemon checksum
04/04/2008 - EO PServer Hosting - 1 Replies
Hi all, i was wondering if anyone knew what the function is that EO uses to calculate the chksum field in the cq_eudemon table? I tried to find it in the source code, but came up blank. Any help is appreciated :)
Calculating Atack or MAtack
05/04/2007 - CO2 Guides & Templates - 4 Replies
Sometimes you wanted know the atack of an trojan and him dont told you? with thats easy guide, you just need open him equipaments window! "JUST 1 percent error" TROJAN ATACK: The follow instructions is both used to lower and higher atack:
Calculating Hours of Pkp
11/23/2006 - CO2 Guides & Templates - 15 Replies
Ever have a black name or more than 30 pk points? This is how to calculate The total time u will have to wait for those 'awful' pk points to get off. 1. Multiply # of pk points by 6. (EX- 100pkp X 6 =600) 2. Divide that number by 60. (EX- 600 / 60) 3. The end number will be the # of hours it will take to get your pkp off.



All times are GMT +1. The time now is 07:34.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2018 elitepvpers All Rights Reserved.