In my program I am using the do-while loop to go through program..
my question is how do I loop the program without the do-while loop...
rather that when the user enters menu number 0, it quits the program...
Teacher uses a script to grade the programs and on hsi example it just runs over and over without it asking "continue?"
any advice?
#include <iomanip>
#include <cstdlib>
#include <iostream>
#include "RetailItem.h"
#include "RetailStore.h"
using namespace std;
const unsigned W = 20;
int main(int argc, char *argv[])
{
RetailItem r;
RetailStore s;
char z;
s.setZero();
do
{
cout<<"This is Programming Assignment #7"<<endl;
cout<<"THE RETAIL STORE MANAGER"<<endl;
cout<<"By Jeremy Rice of CSCI 111"<<endl;
cout<<"Please choose from the following options"<<endl;
cout<<"\n 1 - Display total inventory"<<endl;
cout<<"\n 2 - Search for an item"<<endl;
cout<<"\n 3 - Add a new item to inventory"<<endl;
cout<<"\n 4 - Sell/Subtract units of an item"<<endl;
cout<<"\n 5 - Buy/Add units of an item"<<endl;
cout<<"\n 6 - Change description of an item"<<endl;
cout<<"\n 7 - Delete an item from the inventory"<<endl;
cout<<"\n 8 - List items that need ordered"<<endl;
cout<<"\n 0 - Quit"<<endl;
cout<<"Your choice: ";
cin>>s.choice;
// IF CHOICE ONE IS ENTERED
// DISPLAY ALL INVENTORY
if (s.choice == 1)
{
cout<<"Item"<<setw(20)<<"Description"<<setw(20)<<"Units on Hand";
cout<<setw(15)<<"Price ($)";
cout<<setw(15)<<"Subtotal($)"<<endl;
s.getStoreInventory();
}
//IF CHOICE TWO IS ENTERED
//SEARCH ITEM BY ITS DESCRIPTION
if (s.choice == 2)
{
s.getSearch();
}
// IF CHOICE THREE IS ENTERED
// ADD INVENTORY TO THE STORE
if (s.choice == 3)
{ …