![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#21 | |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5
![]() |
Quote:
|
|
|
|
|
|
|
#22 |
|
Hobbyist Programmer
Join Date: Nov 2006
Posts: 111
Rep Power: 2
![]() |
double getOverlap (Span *span1, Span *span2)
I'm stuck then! I need to think of a way to implement the same task using pointers in the parameters. If this |
|
|
|
|
|
#23 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5
![]() |
Read my second last post (#20 in this thread): the answer is there, but you will have to think about it.
|
|
|
|
|
|
#24 |
|
Hobbyist Programmer
Join Date: Nov 2006
Posts: 111
Rep Power: 2
![]() |
I used the same idea as post 20. Your advice was to use the ->
since we are dealing with pointer parameters. double getOverlap (Span *span1, Span *span2)
{
int high, low;
if (span1 -> low() > span2 -> low())
low = span1 -> low();
else
{
low = span2 -> low();
}
if (span1 -> high() < span2 -> high())
high = span1 -> high();
else
{
high = span2 -> high();
}
int a = high - low;
if (a>=0)
return a;
else
return 0;
} |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to create struct containing variable array struct | shoeyfighter | C | 14 | Nov 6th, 2006 3:26 AM |
| Casting a struct to s aimilar struct | shoeyfighter | C | 6 | Oct 27th, 2006 2:59 PM |
| struct question | n00b | C++ | 9 | Oct 15th, 2006 11:26 AM |
| Appreciate comments on some linked list code | Jessehk | C | 5 | Jul 20th, 2006 7:59 PM |
| confusing question from assignment | silvia | C++ | 1 | Jul 29th, 2005 4:29 AM |