Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have the code below to create a biilingual dictionary using C code but cannot get the output I need. There is a screen shot

I have the code below to create a biilingual dictionary using C code but cannot get the output I need. There is a screen shot of the output that is needed on the bottom. Can you fix the error/s if any?

#include

#include

#include

typedef struct

{

char dname[15];

char dwrd[15];

char cnvrt[15];

}

dict;

void

edit_dict (dict di) /* edit dictionary words */

{

int ad_chc, i, j, k;

char srch[15], upd[15];

printf

("Press 1 For inserting words dictionary Press 2 For deleting words dictionary Press 3 For updating words dictionary ");

scanf ("%d", &ad_chc);

switch (ad_chc)

{

case 1: /* inserting words dictionary */

printf

("Enter the dictionary words first and the converted words followed: ");

for (i = 0; i

{

scanf ("%s", &di.dwrd[i]);

scanf ("%s", &di.cnvrt[i]);

printf ("Success !! ");

}

break;

case 2: // deleting words dictionary

printf ("Enter the word you wan to delete: ");

scanf ("%s", &srch);

for (i = 0; i

{

if (strcmp (srch, di.dwrd[i]) == 0)

{

printf ("Success !! ");

printf ("Deleted word is : %s ", srch);

di.dwrd[i];

di.cnvrt[i];

}

else

printf ("Entered word not found ");

}

break;

case 3: /* updating words dictionary */

printf ("Enter the word you wan to update: ");

scanf ("%s", &upd);

for (i = 0; i

{

if (strcmp (upd, di.dwrd[i]) == 0)

{

printf ("Word %s need to be updated with word ", di.dwrd[i]);

scanf ("%s", di.dwrd[i]);

scanf ("%s", di.cnvrt[i]);

printf ("Success !! ");

}

else

printf ("Entered word not found hence not updated ");

}

break;

default:

printf

("Invalid option.... Press 1 For inserting words dictionary Press 2 For deleting words dictionary Press 3 For updating words dictionary");

}

}

int

main ()

{

dict di[4]; /* array of dictionary */

int chc, u_chc = 0, i, j, k, num, optn, indx;

printf ("//// === Welcome to System ==== //// ");

u_chc_lbl:

printf

("Press 1 For Creatinng dictionary Press 2 For display all available dictionaries Press 3 For display contents of dictionary Press 4 For edting words of dictionary Press 5 For exit ");

scanf ("%d", &u_chc);

switch (u_chc)

{

case 1: /* Create dictionary */

printf ("Enter the number of dictionary you want ");

scanf ("%d", &num);

for (i = 0; i

{

printf ("Enter the dictionary name ");

scanf ("%s", &di[i].dname);

printf ("Success !! ");

}

break;

case 2: /* display all available dictionaries */

if (num >= 0)

{

printf ("List of available dictionaries are: ");

for (i = 0; i

{

printf ("%s ", di[i].dname);

}

}

else

printf ("NO dictionaries available.... ");

break;

case 3: /* display contents of a dictionary */

printf ("Press number between 1 to %d in which dictionary to display",

num);

scanf ("%d", &indx);

printf ("****************************** ");

printf ("Name is %s ", di[indx].dname);

printf ("Words are ");

for (k = 0; k

printf ("%s \t %s", di[indx].dwrd[k], di[indx].cnvrt[k]);

break;

case 4: /* edting words of dictionary */

printf ("Press number between 1 to %d in which dictionary to insert",

num);

scanf ("%d", &optn);

edit_dict (di[optn]); // passing in which structure the words will be done

break;

case 5:

exit (0);

default:

printf ("Invalid option");

}

printf ("Press any number from 1 to 9 to continue or 0(zero) for exit ");

scanf ("%d", &chc);

if (chc >= 1 && chc

goto u_chc_lbl;

return 0;

}

Required output

image text in transcribed

Name of the product: English to Spanish dictionary Description: This software... Developer: Xxxx Xcxx Date of creation: 11/24/2017 Number of words in this dictionary: 1 English (Field: max 30 characters) Spanish (Field: max 30 characters) Class clase

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions