Пример #1
0
BOOL InsertWord(DICT dict, WORD word){
/* 
  adds word to dictionary , if word can't be added returns false else returns true
*/
if(FullDictionary(dictionary) == true){
	return false;
}
else{
	// Checking if word is already inside
	for(int i = 0; i < MAX; i++){
		if(dict[i].compare(word) == 0){
			count[i]++;
			break;

	//otherwise add the word
		}else{
			if(dict[i].empty()){
				dict[i] = word;
				count[i]++; 
				numWord++;
				break;
			}
		}
	}
	return true;
}
}
/* 
  adds word to dictionary , if word can't be added returns false else returns true
*/
BOOL InsertWord(DICT dict, WORD word)
{
	if (FullDictionary(dict)) return 0;
	
	dict[wordCnt] = word;
	count[wordCnt]++;
	wordCnt++;
	return 1;
}
/* 
  adds word to dictionary , if word can't be added returns false else returns true
*/
BOOL InsertWord(DICT &dict, WORD word)
{
	if (FullDictionary(dict)) return false;
	
	ENTRY *newWord = new ENTRY;

	newWord->count = 1;

	newWord->w = word;
	newWord->nextWord = dict.Words;

	dict.Words = newWord;
	dict.numWords++;

	return true;
}