Making A Program That Outputs Array Values

This is a discussion on Making A Program That Outputs Array Values within the C Programming forums, part of the General Programming Boards category; Can anyone help me write this program in C. Im drawing a blank right now and cant figure out what ...

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    23

    Making A Program That Outputs Array Values

    Can anyone help me write this program in C. Im drawing a blank right now and cant figure out what Im Supposed to do. I know that the User is supposed to input a number of values then input each value individually. I wrote a little bit of the program but Im getting a ton of errors.

    Sending and Scanning an Array in C?
    I dont really understand what i'm supposed to do here. It supposed to scan the user input values in an array then figure out which is the smallest, biggest, and average

    The prototypes for the functions must be:

    void GetValues(int x[], int *pN);
    int FindBig(int x[], int n);
    int FindSml(int x[], int n);
    float FindAvg(int x[], int n);

    GetValues should put values in both the x[] array and at *pN
    FindBig should return the largest integer in the first n elements of x[]
    FindSml should return the smallest integer in the first n elements of x[]
    FindAvg should return the average of the first n elements of x[]

    Thus, the main program should look something like the following:
    #define _CRT_SECURE_NO_WARNINGS
    #include <stdio.h>
    // prototypes as listed above
    void main()
    {
    int a[100], myBig, mySml, n;
    float myAvg;
    GetValues(a,&n);
    myBig=FindBig(a,n);
    mySml=FindSml(a,n);
    myAvg=FindAvg(a,n);
    printf("The largest value is: %d\n",myBig);
    printf("The smallest value is: %d\n",mySml);
    printf("The average value is: %.2f\n",myAvg);
    }

    Example of What Its Supposed to Do.

    Enter number of integer values: 5
    Enter value 1: 20
    Enter value 2: -15
    Enter value 3: 90
    Enter value 4: 2
    Enter value 5: 30
    The largest value is: 90
    The smallest value is: -15
    The average value is: 25.40

  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,425
    I wrote a little bit of the program but Im getting a ton of errors.
    so post a "little bit" of what you wrote
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [C++] Need Help Making Menu Program
    By Bartvo in forum C++ Programming
    Replies: 2
    Last Post: 03-09-2010, 11:14 PM
  2. c++ a very simple program
    By amjad in forum C++ Programming
    Replies: 1
    Last Post: 05-27-2009, 12:59 PM
  3. Replies: 1
    Last Post: 12-30-2007, 09:08 AM
  4. making a math quiz program
    By mackieinva in forum C Programming
    Replies: 10
    Last Post: 09-17-2007, 03:38 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21