rendered paste body//PA6 Pgm 2
//Udit Meghraj
// March 23
#include "apmatrix.h"
#include "apstring.h"
#include <iostream.h>
bool itemfound=false;
apstring item;
apmatrix<apstring>store(3,5);
int i;
void main()
{
apstring item;
store[0][0]="Apple";
store[0][1]="Tea";
store[0][2]="Broccli";
store[0][3]="Milk";
store[0][4]="Soda";
store[1][0]="Cheese";
store[1][1]="Tomato";
store[1][2]="Bread";
store[1][3]="Water";
store[1][4]="Orange";
store[2][0]="Peas";
store[2][1]="Garlic";
store[2][2]="Olives";
store[2][3]="Onions";
store[2][4]="Potato";
cout<<"Stan's Grocery Store! "<<endl;
for(int i=0;i<store.numrows();i++)
for(int j=0; j<store.numcols();j++)
cout<<store[i][j]<<endl;
cout<<"Enter an item"<<endl;
cin>>item;
bool itemfound=false;
while( item!="ZZZ"&&(!itemfound))
{
for(int i=0;i<store.numrows();i++)
for(int j=0;j<store.numcols();j++)
{
if(item==store[i][j])
{
cout<<"You will find "<<item<<" is aisle ";
cout<<i<<" "<<"item"<<j<<endl;
itemfound=true;
}
}
if(itemfound)
cout<<" is not here"<<endl;
cout<<"Enter as item "<<endl;
cin>>item;
}
if(!itemfound)
{
cout<<"is not here"<<endl;
cout<<" Thanks for shopping at Stan's Grocery Store! "<<endl;
}
}