Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 21st, 2006, 7:16 PM   #21
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 915
Rep Power: 4 The Dark is on a distinguished road
This code:
				for(int j = index+1; j<tableSize; j++)
				{
					if(strncmp (table[j].c_str(),test.c_str(),3) == 0)
					{
						table[j] = holder[i];
						cout << holder[i] << " ADDED AT POSITION " << j << endl;
					}
					else
						end = true; // Used to wrap around the array if no empty locations before end of array
				}
I'm pretty sure you want to break out of the loop after you put the item into the table array, rather than filling in the whole table with the new value.
The Dark is offline   Reply With Quote
Old Nov 21st, 2006, 7:18 PM   #22
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 915
Rep Power: 4 The Dark is on a distinguished road
With that and the next loop fixed I get this output
1 : with
2 : will
3 : goat
4 : and
5 : or
6 : boat
7 : with
8 : eat
9 : train
10 : I
11 : box
12 : fox
13 : there
14 : ~~~
15 : Eggs
16 : not
17 : house
18 : ~~~
19 : Sam
20 : ~~~
21 : am
22 : rain
23 : would
24 : ~~~
25 : do
26 : any
27 : ~~~
28 : ~~~
29 : them
30 : here
31 : where
32 : ~~~
33 : ~~~
34 : a
35 : Ham
36 : will
37 : like
38 : Green
39 : eat
40 : Don't
41 : ~~~
42 : ~~~
43 : in
44 : could
45 : ~~~
46 : the
47 : on
The Dark is offline   Reply With Quote
Old Nov 21st, 2006, 10:04 PM   #23
codylee270
Unverified User
 
Join Date: Sep 2005
Posts: 209
Rep Power: 0 codylee270 is an unknown quantity at this point
And yes Jimbo, that is the exact output I got, with repetitions.

OK, breaks do work in the for loop. NICE!

THANK YOU DARK - Saving the day AGAIN!

Last edited by codylee270; Nov 21st, 2006 at 10:18 PM.
codylee270 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB 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
c++ linkage errors angry_asian C++ 11 Jun 24th, 2006 8:05 PM
String I/O and Vector Insert errors wingz198 C++ 1 Oct 18th, 2005 10:47 PM
Very annoying errors Aphex_Twin C++ 2 Jun 9th, 2005 4:43 PM
Function Calls and Errors! glopal C++ 5 May 4th, 2005 11:09 AM
scandir etc errors in MSVC. Siphon C++ 5 Feb 4th, 2005 4:15 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:58 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC