All pastes #1852435 Raw Edit

PA 6 pgm 2

public text v1 · immutable
#1852435 ·published 2010-03-26 01:10 UTC
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;
	}
}