I am working on a C program which accepts a string from the user.
add, show, printall, find, delete, and quit.
The program must allow the user to type a partial or full option name (listed above) to choose an option.
For example, if the user gives 'a' or 'ad', the program must accept it as an option for add. (I AM HAVING TROUBLE WITH THIS PART)
My code below:
while(strcmp(input, "quit") != 0)
{
printf("Add a record");
printf("\nShow a record");
printf("\nDelete a record");
printf("\nFind a record");
printf("\nPrint all records");
printf("\nQuit");
scanf("%s", &choice);
/*Above it says it should accept a or ad for 'add'. In my actual code it only accepts add. That's what I need help with. */
if(strcmp(choice, "add") == 0)
{
addMenu(&start);
}
else if(strcmp(choice, "delete") == 0)
{
deleteMenu(&start);
}
else{
printf("\nInvalid menu choice!");
}... other options
}