GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 27-Feb-2005, 00:21
njypa njypa is offline
New Member
 
Join Date: Feb 2005
Posts: 2
njypa is on a distinguished road

duplicate numbers in array?


can anyone help me with comparing numbers in array? Please let me know the instruction how to do it, pseudocode shoule be fine. Thank you
For example,

user enter: 1 2 1 1 2, 3, etc;
output: Duplicate number are: 1 1 1, 2 2
  #2  
Old 27-Feb-2005, 17:08
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,258
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Quote:
Originally Posted by njypa
can anyone help me with comparing numbers in array? Please let me know the instruction how to do it, pseudocode shoule be fine. Thank you
For example,

user enter: 1 2 1 1 2, 3, etc;
output: Duplicate number are: 1 1 1, 2 2
Use two nested loops. First loops thru your numbers. The second (inside the first) again loops thru the numbers comparing the number pointed to by each loop. There's a little more bookkeeping that needs to be done to make sure you don't count the numbers more than one. I leave that for you to ponder.
__________________

Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough.
-- Pearl Williams
 
 

Recent GIDBlogStupid Management Policies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
need help with array njypa C++ Forum 7 24-Feb-2005 15:07
template comiling problems - need expert debugger! crq C++ Forum 1 01-Feb-2005 22:26
Function and Array (w/ reference variables) question brookeville C++ Forum 15 07-Dec-2004 02:11
more array help (simulation project..) dilmv C++ Forum 6 17-Oct-2004 08:51

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 08:15.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.