|
-
Nov 20th, 2001, 04:03 AM
#1
Thread Starter
transcendental analytic
Yep, i was at uni and i don't have a compiler there, it should be the other way around
*(ib+=*ia==*ib)=*ia++
which means the target will only increment when the values are equal.
Notice the target iterator ib will the last result value, meaning you cut of the last numbers, also ib<&both[MAX_LENGTH_BOTH] not ia
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 20th, 2001, 10:15 AM
#2
Fanatic Member
k i made the changes:
for(int* ia=both,* ib=both;ib<&both[MAX_LENGTH_BOTH];*(ib+=*ia==*ib)=*ia++;
get a parse error somewhere in there. 
D!m
-
Nov 20th, 2001, 10:22 AM
#3
Thread Starter
transcendental analytic
did you forget the closing parentesis for for( ; ; );
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 20th, 2001, 10:27 AM
#4
Fanatic Member
Put the last one in and the output is even crazier...this is what i get now:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-
Nov 20th, 2001, 10:35 AM
#5
Thread Starter
transcendental analytic
ok this should work
for(int* ia=both,* ib=both;ib<&both[MAX_LENGTH_BOTH];ib+=*ia!=*ib)*ib=*ia++;
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 20th, 2001, 10:48 AM
#6
Fanatic Member
Almost there....it does remove the doubles...but when printing out the array using this code:
for(j = 0; j <= (MAX_LENGTH_BOTH); j++)
cout << both[j] << " ";
It places the the doubles along with some other numbers at the end of the array...how would i resize the array based on how many doubles there were found.
Going from something like this:
-1 0 0 2 2 3 4 4 5 6 7
To:
-1 0 2 3 4 5 6 7
Thanx for stickin with me kedaman...
-
Nov 20th, 2001, 10:56 AM
#7
Thread Starter
transcendental analytic
depends.
if you treat both as a buffer and have say a terminator t, then t=ib, and you iterate like this:
for(int*j=both;j<t;j++)
cout << *j << " ";
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 20th, 2001, 05:26 PM
#8
Fanatic Member
k it seems to be working well...thank you for your help.
Have a look at my other post...maybe you can help there also.
Thanx,
D!m
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|