0

I will be posting bits and pieces of my code that is relevant.

//Function Prototype
int binarySearch(char*); // Binary search of dictionary. the Function I'm passing to.

char* reverseTruncateCipher[80]; <---- variable I'm passing.

/*I have these variables stored in them
reverseTruncateCipher[0] = all
reverseTruncateCipher[1] = generalizations
reverseTruncateCipher[2] = are
reverseTruncateCipher[3] = false

also I have an int variable named "incrementer" initialized at 0*/

while(binarySearch(reverseTruncateCipher[incrementer]) >= 0)
{
    //random code here
    incrementer++;
}


/* Now here is where I have my problem. The variable I catch 
reverseTruncateCipher[incrementer] with is called searchWords.
In my binarySearch function, I did:

cout << searchWords;
system("pause");
and it printed out "all generalizations are false". Why is it sending the 
whole array when I really just want to send in one word at a time?

Can someone please help me? THANK YOU! */
2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by Ancient Dragon
0

I think you are misunderstanding what that function is doing. It is only printing one word at a time, but it doesn't print a '\n' after each word. do this and each word should be on its own line.
cout << searchWords << '\n';

Edited by Ancient Dragon

0

Not with the system("pause"); there. When it pauses it still prints out the full line.

Edited by Carc369

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.