Click here to Skip to main content
16,018,394 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Compile error about MACRO Pin
George_George26-Nov-07 4:30
George_George26-Nov-07 4:30 
Questioncan not close file in a loop to access an array of files [modified] Pin
mrby12325-Nov-07 18:53
mrby12325-Nov-07 18:53 
AnswerRe: can not close file in a loop to access an array of files Pin
Stephen Hewitt25-Nov-07 19:04
Stephen Hewitt25-Nov-07 19:04 
QuestionRe: can not close file in a loop to access an array of files Pin
Mark Salsbery25-Nov-07 19:09
Mark Salsbery25-Nov-07 19:09 
QuestionGUID_DEVICE_BATTERY error Pin
joshiprashant25-Nov-07 18:50
joshiprashant25-Nov-07 18:50 
AnswerRe: GUID_DEVICE_BATTERY error Pin
Florin Crişan25-Nov-07 22:06
Florin Crişan25-Nov-07 22:06 
AnswerRe: GUID_DEVICE_BATTERY error Pin
JudyL_MD26-Nov-07 2:55
JudyL_MD26-Nov-07 2:55 
QuestionWhile loop only works the first time through?? Pin
Officially Drew™25-Nov-07 17:25
Officially Drew™25-Nov-07 17:25 
I am working on hashing homework code and i have hit a wall.
The first time through a while loop, it works fine, but every time after that, it is not working correctly.
The output currently looks like:

ending address: Cluster size:
4 5 <- this is correct
97 0 <- this should be 1
116 0 <- this should be 1
241 5 <- this should be 6


Here is the code i wrote:

void HashTable::clusterCount(void)
{
unsigned long numClusters=0;
unsigned long clusterLength=0;
unsigned long i=0;
unsigned long totalLength = 0;
while(i<tableSize)
{
//startCluster=clusterLength;
clusterLength = 0;
while((i<tableSize)&&(hashTableArray[i]!=0)){
clusterLength++;
i++;
}

totalLength += clusterLength;
cout<< (i-1) <<" "<< clusterLength <<endl;
while((i<tableSize)&&(hashTableArray[i]==0))
{
i++; // increments i when the array address is empty

}
numClusters++;
i++;
}

cout<<"average cluster Length "<<totalLength/numClusters<<endl;
cout<<"numClusters "<<numClusters<<endl;
}
AnswerRe: While loop only works the first time through?? Pin
Paresh Chitte25-Nov-07 18:09
Paresh Chitte25-Nov-07 18:09 
GeneralRe: While loop only works the first time through?? Pin
Officially Drew™25-Nov-07 18:41
Officially Drew™25-Nov-07 18:41 
GeneralRe: While loop only works the first time through?? Pin
Paresh Chitte25-Nov-07 23:13
Paresh Chitte25-Nov-07 23:13 
Questionscoket in c++ Pin
manish.patel25-Nov-07 16:10
manish.patel25-Nov-07 16:10 
AnswerRe: scoket in c++ Pin
Stephen Hewitt25-Nov-07 17:38
Stephen Hewitt25-Nov-07 17:38 
GeneralRe: scoket in c++ Pin
manish.patel25-Nov-07 18:09
manish.patel25-Nov-07 18:09 
AnswerRe: scoket in c++ Pin
Hamid Taebi25-Nov-07 18:21
professionalHamid Taebi25-Nov-07 18:21 
AnswerRe: scoket in c++ Pin
Mark Salsbery25-Nov-07 18:39
Mark Salsbery25-Nov-07 18:39 
QuestionNoob question on structs, and their local variables Pin
Anthony Mushrow25-Nov-07 11:19
professionalAnthony Mushrow25-Nov-07 11:19 
AnswerRe: Noob question on structs, and their local variables Pin
Stephen Hewitt25-Nov-07 11:46
Stephen Hewitt25-Nov-07 11:46 
GeneralRe: Noob question on structs, and their local variables Pin
Anthony Mushrow25-Nov-07 11:57
professionalAnthony Mushrow25-Nov-07 11:57 
GeneralRe: Noob question on structs, and their local variables Pin
Stephen Hewitt25-Nov-07 12:03
Stephen Hewitt25-Nov-07 12:03 
GeneralRe: Noob question on structs, and their local variables Pin
Priya_Sundar26-Nov-07 0:19
Priya_Sundar26-Nov-07 0:19 
QuestionClick and drag combobox Pin
Wxffles25-Nov-07 9:46
Wxffles25-Nov-07 9:46 
QuestionCString problem in visual C++ 2005 Pin
DSPCottage25-Nov-07 8:53
DSPCottage25-Nov-07 8:53 
QuestionRe: CString problem in visual C++ 2005 Pin
Mark Salsbery25-Nov-07 9:04
Mark Salsbery25-Nov-07 9:04 
AnswerRe: CString problem in visual C++ 2005 Pin
DSPCottage25-Nov-07 9:19
DSPCottage25-Nov-07 9:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.