1

Hello, I'm new to both C++ and these forums. What I'm trying to do is calculate the average of all values contained within an array. Is there a simple command that can do this for you, or does one need to set up some kind of loop? Any help or suggestions would be greatly appreciated.

Thanks

3
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by ~s.o.s~
1

If you are just starting, you'll probably want a loop (the STL does have a function to do [edit]summing[/edit], but I'm guessing that if you posted this question then you need to start further back). The average would be the sum divided by the total number of items.

1

It would really benefit to you if you could read on some introductory material to the C++ programming language or some newbie book like "Sams Teach yourself C++ in 21 days" to get the hang of the subject.

This forum will help you definately if you get stuck in your coding attempt anytime but before that you must know the basics of the language and must have dedicated some time and research on it.

Anyways, welcome to the coding hell.

PS: Long time no see Mr. Dave. Welcome back.

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.