Need help with C language, specifically array

Hewlett-packard 4x dvd module mpeg decod...
April 25, 2010 at 00:32:08
Specs: Windows 7
First declare an array that is large enough to hold at most 25 floating point values.

You are to ask the user to enter a value in the range of 5 to 25. The program should continue to ask the user to enter a value until he successfully enters a value in this range. You're free to use the function we had in the notes to actually get the proper value.

You are then to get the indicated number of values from the user and store them in the previously-defined array.

After you have gotten all the numbers from the user, you are to find and display the sum and the average of all the values the user entered.

You are then to display the average of all the values the user entered that are greater than 100.0.

Finally, you are to display all the numbers the user entered, but only display three per line.

I tried looking at my notes for class but of course there wasn't enough info and this stuff is pretty confusing to me for a non major. Thanks for the help.


See More: Need help with C language, specifically array

Report •

#1
April 25, 2010 at 14:25:08
Lol! that's what you get for sleeping in class! :^)
here's the gist, first you need a while-loop to capture the first item:
while (input<5||input>25) {...
then you need a for-loop to capture the array element values:
for (j=1;j<input;j++) {
cin>>arr[j];
}
then you need a final for-loop to analyze & display:
for (j=1;j<input;j++) {
cout << arr[j];
if j%3 =0 cout<<"\n:";
sum+=arr[j];
if (arr[j]>=100) sumbig+=arr[j];
/* etc etc */
}

Report •

#2
April 25, 2010 at 14:34:43
that's what you get for sleeping in class!
Yes, let this be a lesson to you. If you slack off, nbrane will do your work for you.

Hey nbrane, you wanna do my work for me, too?


Report •
Related Solutions


Ask Question