CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2010
    Posts
    46

    Quick Help Simple Question

    I am having problems writing a function that calculates the average of 5 numbers inputted by user. This is all very confusing to me and has been eversince they were introduced. I am not sure which parameters to use i think it should look like

    int funcAverage (int numbers, int sum)

    really do not know how to write the definition and this is where I need help. I am not sure which variables go where. I dont want you guys to do the work for me, I just need soeone to explain how this all goes together. I am at a point of complete frusteration and am ready to quit.

  2. #2
    Join Date
    Mar 2010
    Posts
    46

    Re: Quick Help Simple Question

    Since the program only requires 5 numbers should I harcode that into the function

    ie.

    int funcAverage(int num1, int num2, int num3, int num4, int num5, int sum)

  3. #3
    Join Date
    Feb 2010
    Posts
    30

    Re: Quick Help Simple Question

    int funcAverage(int num1, int num2, int num3, int num4, int num5, int sum) would be the simplest or you could put the *******s in an array and pass by address

  4. #4
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: Quick Help Simple Question

    Code:
    int Average(int array[5]);
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured