473,320 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Backward processing of an array

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
3 1480
"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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: jdemello | last post by:
When using a multidimensional associative array to cross-reference data in a second, single-dimensional array, PHP stops processing data after a few iterations. Memory usage according to the task...
8
by: dmcconkey | last post by:
Hi folks, I have a client with four websites. Each site has a contact form that is identical. They all have "required" fields validated through a JavaScript onSubmit() function. Upon validation,...
2
by: Neal Becker | last post by:
How can I write code to take advantage of new decorator syntax, while allowing backward compatibility? I almost want a preprocessor. #if PYTHON_VERSION >= 2.4 @staticmethod ....
23
by: Daniel Rudy | last post by:
Hello, I'm trying to learn how command line arguments are handled in C. The following code segment that I wrote as a test program compiles, but when I try to run it, it core dumps. This is...
0
by: Claire | last post by:
My application has a thread reading byte arrays from an unmanaged dll(realtime controller monitoring). The array represents an unmanaged struct containing a series of header fields plus a variable...
3
by: pemo | last post by:
Opinion please. The code below is an attempt at demonstrating commandline arg processing. I don't really like the repetitive use of ... if(!(*s)) { // Make sure we don't go out of bounds....
5
by: paul | last post by:
Hi all, Could some kind soul peruse the following code and see if there is anything wrong with it? Its producing output, but its only occupying the first third of the output array; to give an...
5
by: B. Williams | last post by:
I need some assistance with random access file processing. I have a function that I would like to change from sequential file processing to random access. Thanks in advance. void...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.