Backward processing of an array

S

sunrise

Can someone help me with this program? Please!

Create an array named fun[] of 20 integers. Initialize it to the
expression: fun = 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.
 
M

Mike Wahler

sunrise said:
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 = 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 > 0 && fun >= lowest && fun <= highest)
printf("%d\n", array);
Thank you.

You're welcome.

-Mike
 
D

David Hilsee

sunrise said:
Can someone help me with this program? Please!

Create an array named fun[] of 20 integers. Initialize it to the
expression: fun = 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.
 
I

Ioannis Vranos

sunrise said:
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 = 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top