Question: #include #include #include #include #define MAX _ ENTRIES 1 0 #define WORD _ LENGTH 2 0 struct DictEnglishTurkishEntry { char english [ WORD _ LENGTH
#include
#include
#include
#include
#define MAXENTRIES
#define WORDLENGTH
struct DictEnglishTurkishEntry
char englishWORDLENGTH;
char turkishWORDLENGTH;
;
struct DictEnglishTurkishEntry dictionaryMAXENTRIES;
int nextElementMAXENTRIES; Array to store the index of the next element
int entryCount ;
int startIndex ; Start index of the dictionary
Function to convert a word to lowercase
void capitalizationControlchar word
int i ;
while wordi Loop until the end of the string
wordi tolowerwordi; Convert each character to lowercase
i;
Function to find the position to insert a new word to keep the dictionary sorted
int findInsertPositionchar englishWord
int i startIndex;
int prev ;
while i && strcmpdictionaryienglish, englishWord
prev i;
i nextElementi;
return prev;
void addEntry
if entryCount MAXENTRIES
printfDictionary is full. No addition can be made.
;
return;
char englishWordWORDLENGTH;
char turkishWordWORDLENGTH;
printfEnter English word: ;
scanfs englishWord;
capitalizationControlenglishWord;
printfEnter Turkish meaning: ;
scanfs turkishWord;
capitalizationControlturkishWord; Apply capitalization control to Turkish word as well
Insert the word at the end of the dictionary
strcpydictionaryentryCountenglish, englishWord;
strcpydictionaryentryCountturkish, turkishWord;
Find the correct position to insert this entry in the sorted list
int prevIndex findInsertPositionenglishWord;
if prevIndex Insert at the beginning
nextElemententryCount startIndex;
startIndex entryCount;
else Insert in the middle or at the end
nextElemententryCount nextElementprevIndex;
nextElementprevIndex entryCount;
entryCount;
printfEntry added successfully.
;
void deleteEntry
if entryCount
printfDictionary is empty. No deletion can be made.
;
return;
char englishWordWORDLENGTH;
printfEnter English word to delete: ;
scanfs englishWord;
capitalizationControlenglishWord;
int i startIndex;
int prev ;
int found ;
int lastIndex entryCount ;
while i
if strcmpdictionaryienglish, englishWord
found ;
if prev
startIndex nextElementi;
else
nextElementprev nextElementi;
if i lastIndex
Move the last entry to the position of the deleted entry
strcpydictionaryienglish, dictionarylastIndexenglish;
strcpydictionaryiturkish, dictionarylastIndexturkish;
nextElementi nextElementlastIndex;
nextElementlastIndex; Mark the last entry as unused
entryCount;
printfEntry deleted successfully.
;
break;
prev i;
i nextElementi;
if found
printfWord not found in the dictionary.
;
void printEntries
if entryCount
printfDictionary is empty.
;
return;
printfEnglishttTurkish
;
int i startIndex;
while i
printfstts
dictionaryienglish, dictionaryiturkish;
i nextElementi;
int main
int choice;
do
printf
Dictionary Menu:
;
printf Add an entry
;
printf Delete an entry
;
printf Print the entries in order
;
printf Quit
;
printfEnter your choice: ;
scanfd &choice;
switch choice
case :
addEntry;
break;
case :
deleteEntry;
break;
case :
printEntries;
break;
case :
printfExiting
;
break;
default:
printfInvalid choice. Please try again.
;
while choice ;
return ;
could you please draw in paper flowchart for this code
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
