Skip to content

Instantly share code, notes, and snippets.

@HSley13
Created September 5, 2023 11:06
Show Gist options
  • Save HSley13/ee2f4182c3c25c4d686de6c2b98934f6 to your computer and use it in GitHub Desktop.
Save HSley13/ee2f4182c3c25c4d686de6c2b98934f6 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cstring>
#include <cctype>
using namespace std;
int main()
{
char *dico[][2]=
{
"Pencil", "something use to write",
"Book", "Something use to read",
"Notebook", "Something use to take Notes",
"Backpack", "Something use to carry your school materials",
"Student", "Someone who is enrolled at a school",
};
char word[80];
int i;
cout<<"Write One these words to have the definition display; ";
cout<<"Pencil"<<endl<<"Book"<<endl<<"Notebook"<<endl<<"Backpack"<<"Student"<<endl;
cin>>word;
for(i=0; *dico[i][0]; i++)
{
if(!strcmp(dico[i][0],word))
{
cout<<dico[i][1]<<endl;
break;
}
}
if(!*dico[i][0]) cout<<"Not Found";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment