Flash Website Builder- Trendy Site Builder is a Flash Site Building tool that helps users build stunning websites. Check Out Custom Custom Logo Design by LogoBee. Website Design and Free Logo Templates available.
 CodingForums.com Have no clue where to start

Before you post, read our: Rules & Posting Guidelines

Enjoy an ad free experience by logging in. Not a member yet? Register.
 11-01-2013, 10:34 PM PM User | #1 javajerry New to the CF scene   Join Date: Nov 2013 Posts: 3 Thanks: 1 Thanked 0 Times in 0 Posts Have no clue where to start Here is an assignment that I have been stuck on for about an hour. This is coding in C. Problem I'm having is reading an unknown number of values. ------------------------------ Statisticians use many different algorithms in addition to the arithmetic average. Two other averages are the geometric and the harmonic mean. Write a program that reads a series of numbers and calculates the average, geometric mean, and harmonic mean. Do NOT use arrays for the series of numbers. Utilize functions for modularity. ----------------------------------- I think I can totally manage this with using arrays, but without them I feel like I have no idea how to even start it. The functions and everything else will be easy to do, if I can find a way to read an unknown number of inputs. I couldn't think of any efficient ways to do so, maybe someone here could point me in the right direction. Thanks a lot!
 11-02-2013, 12:09 AM PM User | #2 felgall Master Coder     Join Date: Sep 2005 Location: Sydney, Australia Posts: 6,092 Thanks: 0 Thanked 579 Times in 569 Posts The arithmetic average is all the numbers added together and divided by how many numbers there were. To do that without an array you'd need two variables - both initially set to zero. Then as you read each number you add the number to the first variable and add 1 to the second variable. When you finish reading numbers the arithmetic average is the value in the first variable divided by the value in the second variable. For reading an unknown number of values you set up a loop that keeps reading until an end of file condition is obtained. __________________ Stephen Learn Modern JavaScript - http://javascriptexample.net/ Helping others to solve their computer problem at http://www.felgall.com/ Beginners need to advise whether they want to learn "Latin" JavaScript for Netscape 3 or "Italian" JavaScript for modern browsers.
 Users who have thanked felgall for this post: javajerry (11-07-2013)
 11-02-2013, 05:19 AM PM User | #3 javajerry New to the CF scene   Join Date: Nov 2013 Posts: 3 Thanks: 1 Thanked 0 Times in 0 Posts Ah! Gotcha. I finally did it. Thank you very much!

 Bookmarks

 Thread Tools Rate This Thread Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home :: Client side development     JavaScript programming         DOM and JSON scripting         Ajax and Design         JavaScript frameworks         Post a JavaScript     HTML & CSS     XML     Flash & ActionScript         Adobe Flex     Graphics and Multimedia discussions     General web building         Site reviews         Building for mobile devices :: Server side development     Apache configuration     Perl/ CGI     PHP         Post a PHP snippet     MySQL         Other Databases     Ruby & Ruby On Rails     ASP     ASP.NET     Java and JSP     Other server side languages/ issues         ColdFusion         Python :: Computing & Sciences     Computer Programming     Computer/PC discussions     Geek News and Humour Web Projects and Services Marketplace     Web Projects         Small projects (quick fixes and changes)         Medium projects (new script, new features, etc)         Large Projects (new web application, complex features etc)         Unknown sized projects (request quote)         Vacant job positions         Looking for work/ for hire         Project collaboration/ partnership         Paid work offers and requests (Now CLOSED)     Career, job, and business ideas or advice     Domains, Sites, and Designs for sale         Domains for sale         Websites for sale         Design templates and graphics for sale :: Other forums     Member Offers     Forum feedback and announcements

All times are GMT +1. The time now is 06:26 PM.