array algarythm

Write your question here.
I am haveing troubles of where to star with this;countValues (lowRange: int, highRange: int); int
//counts and return the number of values that are >= lowRange and <= highRange
+isNumberFound(someNumber: int); bool
//if the array contains someNumber, return true, otherwise return false
+display():void //*
any ideas

You do lack context.

In the first you simply iterate over X, test the condition with each value, and if condition holds, increase a counter. Counter starts at 0, and should hold the correct value, when the iteration is over.

In the second the test condition is simpler and you can abort the iteration, if it is true.

Third: display what?

All three functions seem to refer to something (X) that you did not tell us about.
void MultyArray::display()
{
for (int i = 0; i < SIZE; i++)
{
cout << "[" << i << "] " << data[i] << endl;
}
}
what do I need to add to that to get the 2d to display?
1. Same question as in http://www.cplusplus.com/forum/general/100059/ ?

2. You don't show type of 'data', so I don't make a guess.

3. You already iterate over a range. What if each item on that range is a range object that you can iterate over?
1
2
3
for each row in rows
  for each column in row
    something
Topic archived. No new replies allowed.