#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main()
{
char name[ ][50] = {"A TIME TO KILL", "ABSALOM", "C++", "HTML", "SQL", "THE HOUSE OF MIRTH","A MODERN APPROACH","NUTSHELL","DATA STRUCTURE"}, item[10]; //declaring the string array and the character array that will contain the string to be matched
int store[ ] = {198, 762, 543, 870, 350, 90,675,435,322};
int i, x, f = 0;
/*entering the item to be found in the string array*/
printf("\n\tEnter the string to be searched(only enter in capital letter):");
scanf("%s", &item);
/*process for finding the item in the string array*/
for (i = 0; i < 5; i++)
{
x = strcmp(&name[i][0], item); //compares the string in the array with the item and if match is found returns 0 and stores it in variable x
if (x == 0)
f = i;
}
printf("\n--------------------X-----------X--------------X-------------------------\n");
/*if match is not found*/
if (f == 0)
printf("\tThe item does not match any name in the list\n");
/*If the match is found*/
else
printf("\t(%s)Item Found. Item quantity available is- %d\n",name[f], store[f]);
return 0;
}