Thread: C programming
View Single Post
Old 11-21-05, 01:31 PM   #6
Subtestube
Anisymbolic
 
Subtestube's Avatar
 
Join Date: Aug 2004
Location: Wellington, New Zealand
Posts: 1,365
Default Re: C programming

My assumption is that supra just means to do a complete check of everything in the array for each number that's read in. All you do in that for loop is check the current input against all the others already in... If you find a duplicate, just set a flag saying 'don't print', and then when you get to the end of the main for loop, print only when the don't print boolean is false, and then re-set it.

Also, bear in mind that Supra's solution uses a size 19 array. That's fine, but you must not try to read the 20th number into the array if you're going to do that, as you'll be out of bounds. You'll need to keep it in an integer (which isn't saving any space in any case). Although numbering starts at 0, a size 19 array will start at 0 and finish at 18 - you won't be able to store the 20th number in it.

EDIT: Also, you shouldn't come here trying to get people to do homework for you - it's not a good look ;|. I'll give advice on how to code a solution, but I won't give you code. (If this were a genuine code problem like "I'm making a graphics thing, how do I get a window in the screen using the GLUT, I'd be much more willing to help).
__________________
Dr Possible: Core 2 Duo E6400 on Gigabyte GA-965P-DS4. Galaxy GeForce 7600GT. 2GB Corsair XMS 2 DDR2-6400 RAM (CL5). ATi Theatre 550 Pro. Windows XP MCE. All stored in Piano black Antec Sonata II, with a broken door.

Mobile: ASUS M2400N, Pentium M 1.5 GHz. 512 MB DDR RAM. Intel EXTREME graphics. Windows XP SP 2 / Ubuntu 5.10.

Ridiculous DOES not have an 'e' in it. It comes from "ridicule" and has less than nothing to do with the colour red.
Subtestube is offline