Popular Posts

6/24/2012

Product Management in C++




Let see the following code :
===================================================
#include<iostream.h>                                                            
#include<conio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
#include<stdio.h>
#include<process.h>
#include<iomanip.h>
class Product
{ public: int id;
char pro_name[20];
float im_price;
float sell_price;
char cate[20];
int i_day,i_mon,i_year;
char sup[20];
int qty;
char staffname[20];
};
typedef class nodetype *pointertype;
class nodetype
{ private: Product info;
nodetype *left;
nodetype *right;
public:  nodetype(){};
void setleft(pointertype ptr);
void setright(pointertype ptr);
friend nodetype* getnode();
friend void initialize(pointertype  *plist);
friend void update(pointertype *,int);
friend void insertend(pointertype *plist,int i);
friend void insertfirst(pointertype  *plist,int i);
friend void insertafter(pointertype *plist,int i);
friend void add(pointertype &ptr,int j,pointertype *plist);
friend void Traverse(pointertype  *plist);
friend void Delete_select(pointertype  *plist,int n);
friend void Delete_menu(pointertype *plist);
friend void Delete_first(pointertype  *plist);
friend void Delete_after(pointertype  *plist, int i);
friend void Delete_after(pointertype  *plist,char *na);
friend void Delete_end(pointertype  *plist);
friend void sell(pointertype  *plist);
friend void sort_inc(pointertype  *plist);
friend void sort_dec(pointertype  *plist);
friend void search(pointertype *plist,int sid);
friend pointertype * initialize();
};
//-------------------------------------Detect_Error_Float------------------
float detect_error_float()
{ char str[30];
float a=9.9;
cin.clear();
cin.seekg(0,ios::end);
cin.get(str,20);
for(int i=0;i<strlen(str);i++)
if(!isdigit(str[i]))
if(str[i]=='.')
{  i++;
for(;i<strlen(str);i++)
if(!isdigit(str[i]))
throw a;
}
else
throw a;
return atof(str);
}
//-------------------------------------Detect_Error_Int------------------
int detect_error_int()
{ char str[30];
cin.clear();
cin.seekg(0,ios::end);
cin.get(str,20);
for(int i=0;i<strlen(str);i++)
if(!isdigit(str[i]))
throw 0;
return atoi(str);
}
//----------------------------------Function initialize--------------
pointertype * initialize()
{ pointertype *plist=new pointertype;
*plist=NULL;
return plist;
}
//----------------------------------Function setleft-----------------------
void nodetype::setleft(pointertype ptr)
{ left=ptr;
}
//----------------------------------Function setright----------------------
void nodetype::setright(pointertype ptr)
{ right=ptr;
}
//----------------------------------Function sell-------------------------
void sell(pointertype *plist)
{ clrscr();
if(*plist==NULL)
{ cout<<"Nothing to order!";
getch();
}
else
{
again:
clrscr();
cout<<"Enter id of product you want to buy:";
int id,i=0;
try
{ id=detect_error_int();
}
catch(int a)
{ goto again;
}
pointertype ptr;
ptr=*plist;
while(ptr!=NULL)
{ if(ptr->info.id==id)
{ i=1;
break;
}
ptr=ptr->right;
}
if(i==1)
{  again1:
clrscr();
cout<<"Enter quentity to order:";
int qty;
try
{ qty=detect_error_int();
}
catch(int a)
{ goto again1;
      }
if(ptr->info.qty<qty)
{ cout<<"Out of order!";
getch();
}
else
ptr->info.qty=ptr->info.qty-qty;
}
else
{ cout<<"Not found!";
getch();
}
}

}
//----------------------------------Delete First----------------
void Delete_first(pointertype *plist)
{ pointertype ptr;
ptr=*plist;
if(*plist==NULL)
cout<<"No Item In Stock!";
else if(ptr->left==NULL && ptr->right==NULL)
{  *plist=NULL;
cout<<"Delete First Success!";
}
else if(ptr->left==NULL && ptr->right!=NULL)
{ ptr=ptr->right;
ptr->left=NULL;
*plist=ptr;
cout<<"Delete First Success!";
}
}
//-------------------------Delete_after (ID) -------------------------
void Delete_after(pointertype *plist,int i){
pointertype p,ptr;
int f=0;
p=*plist;
while(p!=NULL){
if(p->info.id==i)
{  if(p->right==NULL)
{ cout<<"This is the last item, so no data can be delete.";
return;
}
ptr=p->right;
p->right=ptr->right;
delete(ptr);
f++;
break;
}
p=p->right;
}
if(f==0) cout<<"\nInput Wrong ID!";
else
cout<<"Delete After Successed!!";
}
//--------------------------Delete After (name)----------------------
void Delete_after(pointertype *plist,char *na){
pointertype p,ptr;
int f=0;
p=*plist;
while(p!=NULL){
if(strcmp(p->info.pro_name,na)==0)
{  if(p->right==NULL)
{ cout<<"This is the last item, so no data can be delete.";
return;
}
ptr=p->right;
p->right=ptr->right;
delete(ptr);
f++;
break;
}
p=p->right;
}
if(f==0) cout<<"\nInput Wrong Name!";
else
cout<<"Delete After successed!!";
}
//-------------------------------Delete_end-------------------------
void Delete_end(pointertype *plist){
pointertype ptr,p;
ptr=*plist;
p=*plist;
if(*plist==NULL)
cout<<"No Item In Stock!";
else if(ptr->left==NULL && ptr->right==NULL){
*plist=NULL;
cout<<"Delete End Success!";
}
else
{ while(ptr->right!=NULL)
ptr=ptr->right;
while(p->right!=ptr)
p=p->right;
p->right=NULL;
delete(ptr);
cout<<"Delete End Success!";
}
}
//------------------------------Delete_select------------------------------
void Delete_select(pointertype *plist,int n)
{  if(*plist==NULL)
{ cout<<"\n\nNothing to delete!";
getch();
}
else
{ pointertype ptr,p;
ptr=*plist;
for(int i=1;i<=n;i++) // n is the node we want to delete.
ptr=ptr->right; // ptr will point to node we want to delete
if(ptr->left==NULL&&ptr->right==NULL) // delete last node when there is only 1 node
{  *plist=NULL;
}
else if(ptr->right==NULL && ptr->left!=NULL) // delete last node when there are only 2 node
{ ptr=ptr->left;
ptr->right=NULL;
}
else if(ptr->left==NULL && ptr->right!=NULL) // delete first node when there are only 2 node
{ ptr=ptr->right;
ptr->left=NULL;
*plist=ptr;
}
else // delete node when nodes are more than 2
{
p=ptr;
ptr=ptr->left;
ptr->right=p->right;
ptr=ptr->right;
ptr->left=p->left;
}
}
}
//-----------------------------------Update----------------------------
void update(pointertype *plist,int id)
{ pointertype ptr;
int a=0;
ptr=*plist;
while(ptr!=NULL)
{ if(ptr->info.id==id)
{  a=1;
break;
}
ptr=ptr->right;
}
if(a==0)
{ cout<<"Not found!";
getch();
}
else                                            
{  cout<<"[1]. Update product name\n [2]. Update import price\n [3]. Sell price\n [4]. Update Category\n [5].Update import day\n [6]. Update import month\n [7]. Update import year\n [8].Update supplier\n [9].Update Quentity\n [10].Update staff's name";
int ch;
again:
cout<<"\nEnter number:";
try
{ ch=detect_error_int();
}
catch(int a)
{ clreol();
goto again;
}
clrscr();
switch(ch)
{ case 1: cout<<"Enter new product name:";
cin.clear();
cin.seekg(0,ios::end);
cin.get(ptr->info.pro_name,20);
break;
case 2:     again2:
clrscr();
cout<<"Enter new import price:";
try
{ ptr->info.im_price=detect_error_float();
}
catch(float a)
{ goto again2;
}
break;
case 3:     again3:
clrscr();
cout<<"Enter new sell price:";
try
{ ptr->info.sell_price=detect_error_float();
}
catch(float a)
{ goto again3;
}
break;
case 4: cout<<"Enter new category:";
cin.clear();
cin.seekg(0,ios::end);
cin.get(ptr->info.cate,20);
break;
case 5:     again4:
clrscr();
cout<<"Enter new import day:";
try
{ ptr->info.i_day=detect_error_int();
}
catch(int a)
{ goto again4;
}
break;
case 6:     again5:
clrscr();
cout<<"Enter new import month:";
try
{ ptr->info.i_mon=detect_error_int();
}
catch(int a)
{ goto again5;
}
break;
case 7:     again6:
clrscr();
cout<<"Enter new import year:";
try
{ ptr->info.i_year=detect_error_int();
}
catch(int a)
{ goto again6;
}
break;
case 8: cout<<"Enter new supplier:";
cin.clear();
cin.seekg(0,ios::end);
cin.get(ptr->info.sup,20);
break;
case 9:    again7:
clrscr();
cout<<"Enter new quentity:";
try
{ ptr->info.qty=detect_error_int();
}
catch(int a)
{ goto again7;
}
break;
case 10: cout<<"Enter new staff's name:";
cin.clear();
cin.seekg(0,ios::end);
cin.get(ptr->info.staffname,20);
break;
}
}
}
//----------------------------------------Traverse-------------------------
void Traverse(pointertype *plist)
{  clrscr();
if(*plist!=NULL)
{
char ch;
int i=2,y=0;
do
{  gotoxy(5,1);
cout<<"ID"<<"     Pro_Name"<<"      Im_price"<<"      Category"<<"       Date"<<"        Quentity";
pointertype ptr;
ptr=*plist;
while(ptr!=NULL)
{  gotoxy(1,2*(y+2)-2); // Frame
cout<<" ----------------------------------------------------------------------------";
gotoxy(1,2*(y+2)-1);
cout<<"|*=>";
gotoxy(78,2*(y+2)-1);
cout<<"|";
gotoxy(1,2*(y+2));
cout<<" ----------------------------------------------------------------------------";

gotoxy(5,2*i-1);
cout.fill('0');
cout<<setw(5)<<setiosflags(ios::right)<<ptr->info.id<<"  ";
cout.fill(' ');
cout<<setw(14)<<setiosflags(ios::left)<<ptr->info.pro_name;
cout.fill('0');
cout<<" "<<setw(5)<<setiosflags(ios::right)<<ptr->info.im_price<<'$';
cout<<"       ";
cout<<setw(14);
cout.fill(' ');
cout<<setiosflags(ios::left)<<ptr->info.cate;
cout<<' ';
cout<<ptr->info.i_day<<'/'<<ptr->info.i_mon<<'/';
cout<<setw(6);
cout<<setiosflags(ios::left)<<ptr->info.i_year;
cout<<"  ";
cout<<setw(8);
cout.fill('0');
cout<<setiosflags(ios::right)<<ptr->info.qty;
ptr=ptr->right;
i++;
}
ch=getch();
switch(ch)
{ case 's': y++;break;
case 'w': y--;break;
case  13:   Delete_select(plist,y); // y can indicate which node we want to delete
if(y==i-3)// protect when delete last node. then the select item will move previous
y--;
                  break;
}
if(y>=i-2)
y=0;
if(y<0)
y=i-3;
i=2;
clrscr();
}while(ch!=27);
}
else
cout<<"Empty list!!";
}
//-------------------------------------Getnode-----------------------
nodetype* getnode()
{ pointertype plist=NULL;
plist=new nodetype;
plist->left=NULL;
plist->right=NULL;
return plist;
}
//-------------------------------------Add-----------------------------
void add(pointertype &ptr,int j,pointertype *plist)
{     clrscr();
int id;
again:
pointertype p;
gotoxy(3,3);
cout<<(j+1);
again7:
gotoxy(5,3);
cout<<"\tEnter id:";
gotoxy(29,3);
cout<<"--------------";
gotoxy(29,3);

try
{ id=detect_error_int();
}
catch (int a)
{ clreol;
goto again7;
}
if(*plist==NULL)
{ *plist=getnode();
(*plist)->right=NULL;
(*plist)->left=NULL;
(*plist)->info.id=id;
}
else
{
for(p=*plist;p!=NULL;p=p->right)
if(id==p->info.id)
goto again;
ptr->info.id=id;
}

gotoxy(5,5);
cout<<"\tEnter Product Name:";
gotoxy(29,5);
cout<<"--------------";
gotoxy(29,5);
cin.clear();
cin.seekg(0,ios::end);
cin.get(ptr->info.pro_name,20);

again1:
gotoxy(5,7);
cout<<"\tEnter Import price:";
gotoxy(29,7);
cout<<"--------------";
gotoxy(29,7);
try{
ptr->info.im_price=detect_error_float();
}
catch (float a)
{ clreol();
goto again1;
}

again2:
gotoxy(5,9);
cout<<"\tEnter Sell price:";
gotoxy(29,9);
cout<<"--------------";
gotoxy(29,9);
 try
 { ptr->info.sell_price=detect_error_float();
 }
 catch (float a)
 {   clreol;
goto again2;
 }
gotoxy(5,11);
cout<<"\tEnter category:";
gotoxy(29,11);
cout<<"--------------";
gotoxy(29,11);
cin.clear();
cin.seekg(0,ios::end);
cin.get(ptr->info.cate,20);

again3:
gotoxy(5,13);
cout<<"\tEnter day:";
gotoxy(29,13);
cout<<"--";
gotoxy(29,13);
try
{ ptr->info.i_day=detect_error_int();
}
catch (int a)
{ clreol();
goto again3;
}

again4:
gotoxy(35,13);
cout<<"Month:";
gotoxy(42,13);
cout<<"--";
gotoxy(42,13);
try
{ ptr->info.i_mon=detect_error_int();
}
catch (int a)
{ clreol();
goto again4;
}

again5:
gotoxy(47,13);
cout<<"Year:";
gotoxy(53,13);
cout<<"----";
gotoxy(53,13);
try
{ ptr->info.i_year=detect_error_int();
}
catch (int a)
{ clreol();
goto again5;
}
gotoxy(5,15);
cout<<"\tEnter supplier:";
gotoxy(29,15);
cout<<"--------------";
gotoxy(29,15);
cin.clear();
cin.seekg(0,ios::end);
cin.get(ptr->info.sup,20);

again6:
gotoxy(5,17);
cout<<"\tEnter quentity:";
gotoxy(29,17);
cout<<"--------------";
gotoxy(29,17);
try
{ ptr->info.qty=detect_error_int();
}
catch (int a)
{ clreol();
goto again6;
}

gotoxy(5,19);
cout<<"\tEnter staff's name:";
gotoxy(29,19);
cout<<"--------------";
gotoxy(29,19);
cin.clear();
cin.seekg(0,ios::end);
cin.get(ptr->info.staffname,20);
}
//----------------------------------------Insertend----------------------------
void insertend(pointertype *plist,int i)
{ pointertype ptr,p;
p=getnode();
add(p,i,plist);
ptr=*plist;
while(ptr->right!=NULL)
ptr=ptr->right;
ptr->right=p;
p->left=ptr;
p->right=NULL;
}
//-------------------------------------------InsertFirst----------------------
void insertfirst(pointertype *plist,int i)
{  pointertype p;
p=getnode();
add(p,i,plist);
p->right=*plist;
p->left=NULL;
p->right->left=p;
*plist=p;

}
//-------------------------------------------Insertafter----------------
void insertafter(pointertype *plist,int i)
{ pointertype p=*plist,ptr;
again:
clrscr();
cout<<"Enter id of data which you want to insert after it:";
int id,a=0;
try
{ id=detect_error_int();
}
catch(int a)
{ clreol();
goto again;
}
while(p!=NULL)
{ if(id==p->info.id)
{ a=1;
ptr=p;
}
p=p->right;
}
if(a==0)
{ cout<<"Not found!!";
getch();
}
else
{ p=getnode();
add(p,i,plist);
p->right=ptr->right;
p->left=ptr;
ptr->right=p;
}
}
//-------------------------------------Delete menu---------------------------
void Delete_menu(pointertype *plist)
{
char menu[3][13]={"Delete First", "Delete After", "Delete End" };
char ch='s';
int y=0;
do
{
for(int j=15;j<20;j++) // Output border of menu
{  gotoxy(43,j);
cout<<"|               |";
}
gotoxy(44,17);
cout<<"---------------";
gotoxy(44,20);
cout<<"---------------";

for(int i=0;i<3;i++)  //Output menu select
{  gotoxy(44,(2*(i+8))-1);
if(i==y)
{  cout<<"*=>"<<menu[i];
gotoxy(44,2*i+14);
cout<<"---------------";
gotoxy(44,2*i+16);
cout<<"---------------";
}
else
cout<<"   "<<menu[i];
}
ch=getch();
switch(ch)
{ case 's': y++; break;
case 'w': y--; break;
case 'a': return;
case 13: clrscr();
if (*plist==NULL)
cout<<"Empty list!!";
else
{
if(y==0)//-----------------------Delete First---------------
{
Delete_first(plist);
}
else if(y==1)//-------------------Delete After--------------
{  if((*plist)->right==NULL&&(*plist)->left==NULL)
cout<<"You can not choose delete after becuase there is only one item left.";
else
{  again:
clrscr();
cout<<"[1].Delete by id\n";
cout<<"[2].Delete by Name\n";
cout<<"Choose one of them:";
int choice;
try
{ choice=detect_error_int();
}
catch(int a)
{ goto again;
}
clrscr();
switch(choice)
{
case 1:     again1:
clrscr();
cout<<"\n\nEnter Id You Want to Delete After:";
int id;
try
{ id=detect_error_int();
}
catch(int a)
{ goto again1;
}
Delete_after(plist,id);
break;
case 2:   cout<<"\n\nEnter Name You Want to Delete After:";
char na[20];
cin.clear();
cin.seekg(0,ios::end);
cin.get(na,20);
Delete_after(plist,na);
break;
}
}
}
else if(y==2)//--------------------------Delete End-------------
Delete_end(plist);
}
getch();
return ;
}
if(y<0)
y=2;
if(y>=3)
y=0;
for(i=0;i<3;i++)  //Output menu select
{  gotoxy(44,(2*(i+7))-1);
cout<<"               ";
}
}while(ch!=27);
}
//------------------------------------Insert Menu-------------------------------
void insert_menu(pointertype *plist)
{ char menu[3][13]={"Insert First", "Insert After", "Insert End" };
char ch='s';
int y=0;
do
{
for(int j=13;j<18;j++) // Output border of menu
{  gotoxy(43,j);
cout<<"|               |";
}
gotoxy(44,15);
cout<<"---------------";
gotoxy(44,18);
cout<<"---------------";

for(int i=0;i<3;i++)  //Output menu select
{  gotoxy(44,(2*(i+7))-1);
if(i==y)
{  cout<<"*=>"<<menu[i];
gotoxy(44,2*i+12);
cout<<"---------------";
gotoxy(44,2*i+14);
cout<<"---------------";
}
else
cout<<"   "<<menu[i];
}
ch=getch();
switch(ch)
{ case 's': y++; break;
case 'w': y--; break;
case 'a':   return;
case 13:    clrscr();
if (*plist==NULL)
add(*plist,0,plist);
else
{ if (y==2)//------------------------Insert End-----------
insertend(plist,0);
else if (y==0)//----------------------Insert First---------
insertfirst(plist,0);
else if (y==1)//----------------------Insert After------------
insertafter(plist,0);
}
return ;
}
if(y<0)
y=2;
if(y>=3)
y=0;
for(i=0;i<3;i++)  //Output menu select
{  gotoxy(44,(2*(i+7))-1);
cout<<"               ";
}
}while(ch!=27);
}
//----------------------------------------Sort Menu------------------------
void sort_menu(pointertype *plist)
{ char menu[2][10]={"Decrease", "Increase", };
char ch='s';
int y=0;
do
{
for(int j=11;j<14;j++) // Output border of menu
{  gotoxy(43,j);
cout<<"|            |";
}
gotoxy(44,10);
cout<<"------------";
gotoxy(44,14);
cout<<"------------";

for(int i=0;i<2;i++)  //Output menu select
{  gotoxy(44,(2*(i+6))-1);
if(i==y)
{  cout<<"*=>"<<menu[i];
gotoxy(44,2*i+10);
cout<<"------------";
gotoxy(44,2*i+12);
cout<<"------------";
}
else
cout<<"   "<<menu[i];
}
ch=getch();
switch(ch)
{ case 's': y++; break;
case 'w': y--; break;
case 'a': return;
case 13:    clrscr();
if(*plist==NULL)
{ cout<<"Empty list!!";
getch();
}
else
{
if(y==0)//---------------------Sort Decrease----------
{ cout<<"dec";
sort_dec(plist);
}//decrease function
else if(y==1)//-----------------Sort Increase-----------
{ cout<<"Inc";
sort_inc(plist);
}
cout<<"Sort Completed!";
getch();
}
return;
}
if(y<0)
y=1;
if(y>=2)
y=0;
for(i=0;i<2;i++)
{  gotoxy(44,(2*(i+6))-1);
cout<<"            ";
}
}while(ch!=27);
}
//-------------------------------------------Search-----------------------
void search(pointertype *plist,int sid)
{  clrscr();
pointertype ptr,*temp=NULL; int f=0;
temp=new pointertype;
ptr=*plist;
while(ptr!=NULL){
if(ptr->info.id==sid)
{ f=1;
*temp=getnode();
(*temp)->info=ptr->info;
(*temp)->right=NULL;
(*temp)->left=NULL;
Traverse(temp);
}  ptr=ptr->right;
}
if(f==0)
cout<<"Information not found!";
}
//--------------------------------------------Sort Increase-----------------
void sort_inc(pointertype *plist)
{
pointertype p,q;
Product temp;
for(p=*plist;p!=NULL;p=p->right)
for(q=p->right;q!=NULL;q=q->right)
if(p->info.id>q->info.id)
{ temp=q->info;
 q->info=p->info;
 p->info=temp;
}

}
//-------------------------------------------------Sort decrease-------------
void sort_dec(pointertype *plist)
{     pointertype p,q;Product temp;
p=*plist;
while(p!=NULL)
{ q=p->right;
while(q!=NULL)
{ if(p->info.id<q->info.id)
{ temp=q->info;
q->info=p->info;
p->info=temp;
}
q=q->right;
}
p=p->right;
}

}
void main()
{ char menu[9][10]={"Add      ", "Traverse ", "Search   ", "Update   ", "Sort    >", "Insert  >", "Delete >", "Sell     ", "Exit     "};
char ch='s';
int y=0;
pointertype *plist;
plist=initialize();
do
{  gotoxy(5,23);
cout<<"Lecturer: Ung Rithy";
gotoxy(60,24);
printf("s=Down w=%c d=%c a=%c",24,26,27);
gotoxy(5,24);
cout<<"Program by M1 students";
gotoxy(5,1);
cout<<"********************";
gotoxy(5,2);
cout<<"*==================*";
gotoxy(5,3);
cout<<"*Product Management*";
gotoxy(5,4);
cout<<"*==================*";
gotoxy(5,5);
cout<<"********************";
for(int j=3;j<20;j++) // Output border of menu
{  gotoxy(30,j);
cout<<"|            |";
}
gotoxy(31,2);
cout<<"------------";
gotoxy(31,20);
cout<<"------------";
for(int i=0;i<9;i++)  //Output menu select
{  gotoxy(31,(2*(i+2))-1);
if(i==y)
{  cout<<"*=>"<<menu[i];
gotoxy(31,2*i+2);
cout<<"------------";
gotoxy(31,2*i+4);
cout<<"------------";
}
else
cout<<"   "<<menu[i];
}
ch=getch();
switch(ch)
{  case 's': y++; break;
case 'w': y--; break;
case 'd': if(y==4)//------------Sort---------
sort_menu(plist);
else if(y==5)//--------------Insert------------
insert_menu(plist);
else if(y==6)//-----------------Delete--------------
Delete_menu(plist);
break;
case 13:    clrscr();
if(y==0)//--------------------------Add--------------
{  again1:
clrscr();
cout<<"Enter n:";
int n;
try
{ n=detect_error_int();
}
catch (int a)
{
goto again1;
}
for(int i=0;i<n;i++)
if(*plist==NULL)
add(*plist,0,plist);
else
insertend(plist,i);
}
else if(y==1)//------------------------------Traverse-------------
{  if(*plist==NULL)
{ cout<<"Empty List!!";
getch();
}
else
Traverse(plist);
}
else if(y==2)//------------------------Search-----------------------
{ if(*plist!=NULL)
{  again:
clrscr();
cout<<"Enter id that u want to search:";
int id;
try
{ id=detect_error_int();
}
catch(int a)
{ goto again;
}
search(plist,id);getch();
}
else
{ clrscr();
cout<<"Empty list!!";
getch();
}
}
else if(y==3)//----------------------------Update------------------
{  if(*plist!=NULL)
{  again2:
clrscr();
cout<<"Enter id that u want to update:";
int id;
try
{ id=detect_error_int();
}
catch(int a)
{ goto again2;
}
update(plist,id);
}
else
{ clrscr();
cout<<"Empty list!!";
getch();
}
}
else if(y==7)//---------------------Sell----------
sell(plist);
else if(y==8)//---------------------------Exit----------
exit(1);
break;
}
if(y<0)
y=8;
if(y>8)
y=0;
clrscr();
}while(1);
}

//Click like and share it to your friends .!

0 comments:

Post a Comment