By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,131 Members | 2,140 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,131 IT Pros & Developers. It's quick & easy.

Backward processing of an array

P: n/a
Can someone help me with this program? Please!

Create an array named fun[] of 20 integers. Initialize it to the
expression: fun[i] = 7 * i * i - 4 * i - 500

where i is the index to the array. Process the array backward and
output only those elements whose values are positive and within a
range as specified by the user.
Thank you.
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"sunrise" <gi******@yahoo.com> wrote in message
news:e2*************************@posting.google.co m...
Can someone help me with this program? Please!

Create an array named fun[] of 20 integers. Initialize it to the
expression: fun[i] = 7 * i * i - 4 * i - 500

where i is the index to the array. Process the array backward and
output only those elements whose values are positive and within a
range as specified by the user.
Thank you.


This sounds like homework. I believe your answer lies in the FAQ
(http://www.parashift.com/c++-faq-lite/) under section 5, questions 2 and
following.

--
David Hilsee
Jul 23 '05 #2

P: n/a
"sunrise" <gi******@yahoo.com> wrote in message
news:e2*************************@posting.google.co m...
Can someone help me with this program? Please!
Certainly, as soon as you show us your program.
You weren't expecting someone to write it for
you, were you?
Create an array named fun[] of 20 integers. Initialize it to the
expression: fun[i] = 7 * i * i - 4 * i - 500
Well, there's one line already written for you.
All you need to do is add the semicolon.
where i is the index to the array. Process
Does 'process' mean the storing of the values,
retrieving the values, or both?
the array backward
Hint: start with the largest index, and count down
to zero.
and
output only those elements whose values are positive and within a
range as specified by the user.
Hint:

if(fun[i] > 0 && fun[i] >= lowest && fun[i] <= highest)
printf("%d\n", array[i]);
Thank you.


You're welcome.

-Mike
Jul 23 '05 #3

P: n/a
sunrise wrote:
Can someone help me with this program? Please!

Just do it a step at a time.
1. > Create an array named fun[] of 20 integers.

2. > Initialize it to the expression: fun[i] = 7 * i * i - 4 * i - 500

where i is the index to the array.

4. > Process the array backward and output only those elements whose values are positive and
3. > within a range as specified by the user.



--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.