Skip to content

Instantly share code, notes, and snippets.

@shaina7837
Created July 14, 2013 07:21
Show Gist options
  • Save shaina7837/5993493 to your computer and use it in GitHub Desktop.
Save shaina7837/5993493 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string.h>
using namespace std;
main()
{
char *p[6] = {"paper", "pen", "pencil", "book"};
char *str;
cout << "enter what you want to purchase? " << endl;
cin >> str;
for (int i = 0; i < 4; i++)
{
if(strcmp(*str, *p[i])==0)
{
cout << "Available " << endl;
break; }
if(i == 4)
{
cout << "NOT " << endl; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment