The assignment is this;
Write a complete 'c' program to populate a eleven element array with a random listing of eleven whole numbers:
Use functions to determine the following:
1) The largest value & the index number of that element
2) The smallest value and the index number of that element
3) The mid-range value and the index number of that element
**He want use to use dynamic arrays.
To me a dynamic array sounds like a multidimesional array, without the function to allocate the memory. I am not sure if that is even the right line to draw between the two. I am really embarresed of the code I have written for it up to now but here it is. I am just trying to fill up the array with 11 random whole numbers and print it out, but I can seem to get that right either.
[code]
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>
int main(void)
{
int wNums[];
int i;
clrscr();
randomize();
for(i=0; i<11; i++)
scanf(" %d", wNums[i]);
printf("%d\n", rand());
getch();
return 0;
}
[\code]



LinkBack URL
About LinkBacks


