#include<iostream>
#include<string>

using namespace std;
int counterofanalog=0;
int counterofdigital=0;
int counterofsmartwatch=0;
int num=0;

//class for Genwatch
class genWatch
{
     private:
        int watch_id;
        string brand;
        int price;
        string colour;
        int date;

  public:
        genWatch()
        {
            watch_id=0;
            brand="";
            price=0;

        }
void adddata()
     {
              cout<<"Please Enter Watch ID:";
              cin>>watch_id;
              cin.ignore();
              cout<<"Please Enter Watch Brand:"<<endl;
              getline(cin,brand);
              cout<<"Please Enter Price: Rm "<<endl;
              cin>>price;
              cin.ignore();
              cout<<"Please Enter Watch colour:"<<endl;
              getline(cin,colour);
              cout<<"PLease enter date:"<<endl;
              cin>>date;
              system("cls");
              cout<<endl<<endl<<"New item has been succesfully added!"<<endl;
              system("pause");
}

void editdetail()
{
                 int a=0;
                 cout<<watch_id<<"\t"<<brand<<"\t"<<price<<"\t"<<date<<endl;
ED:              cout<<"Do you want to continue editing?:"<<endl;
                 cout<<"\t1:YES\t2:NO"<<endl;
                 cin>>a;
                 if(a==1)
                 {
                    cout<<"\nPlease Enter New Watch ID of the watch:"<<endl;
                    cin>>watch_id;
                    cin.ignore();
                    cout<<"\nPlease Enter New brand of the watch:"<<endl;
                    getline(cin,brand);
                    cout<<"\nPlease Enter New price of the watch:"<<endl;
                    cin>>price;
                    cin.ignore();
                    cout<<date;
                    system("cls");
                    cout<<"Data has been updated@edited"<<endl;
                    system("pause");
                 }  
                 else if(a!=2&&a!=1)
                 {
                      cout<<"\nWrong instruction.PLease choose again"<<endl;
                      goto ED;
                }
              }
void deletedata()
                 {
                 watch_id=0;
                 brand="";
                 date=0;
                 }  
                 int getID()
                 {
                   return watch_id;
                  }
                  int getdate()
                  {
                  return date;
                  }
void view()
                 {
                    cout<<num<<")"<<watch_id<<"\t"<<brand<<"\t"<<date<<endl;

               }


}record[10]
;
//derived class
class stock
{
      private:
        genWatch listofgenWatch[10];
        string watch_type;
        string stock_venue;
        double discount;
public:
        void detailsOfStock(string w,string x,double y)
        {
            watch_type=w;
            stock_venue=x;
            discount=y;
        }
        stock()
        {
            watch_type="";
            stock_venue="";
            discount=0.0;
        }
void menu()
        {
            system("cls");
            cout<<"\n\tMENU"<<endl;
            cout<<"1.Add record"<<endl<<"2.Delete record"<<endl<<"3.Edit Record"<<endl<<"4.View Record"<<endl<<"5.Exit"<<endl;
            cout<<"Enter Your choice:";
        }

        void add(int x)
        {
            int count=x;
            listofgenWatch[count].adddata();
        }

        void editdetails(int x,int y)
        {
            int count=y;
            for(int a=0;a<count;a++)
            {
                if(listofgenWatch[a].getID()==x)
                {
                    listofgenWatch[a].editdetail();
                    break;

                }
                else
                {
                    cout<<"NO Record Found"<<endl;
                    system("pause");
                    break;
                }
            }
        }
int deletedata(int y,int z)
    {
        int count=z;
        for(int a=0;a<z;a++)
        {
DE:         if(listofgenWatch[a].getID()==y)
            {
                int d=0;
                listofgenWatch[a].view();
                cout<<"The record was deleted"<<endl;
                z--;
                return z;
                system("pause");
            }

            else if(a==z-1)
                {
                cout<<"NO record matched"<<endl;
                system("pause");
                goto DE;
                }
            }
        }
        void view(int x)
        {
            int count=x;
            int num=1;
            if(count==0)
            {
                cout<<"No record found"<<endl;
                system("pause");
            }
            else
            {
                for(int d=0;d<count;d++)
                {
                    listofgenWatch[count].view();
                    num++;
                }
                system("pause");
            }
        }
};
int main()
{
    stock analog;
    stock digital;
    stock smartwatch;

    int choiceofmenu=0;
    int choiceofstock=0;

    analog.detailsOfStock("Analog watch","room1",0.5);
    digital.detailsOfStock("Digital watch","room2",0.6);
    smartwatch.detailsOfStock("Smartwatch","room3",0.7);

AB: cout<<"________________________________________________________________________________\n";
    cout<<"\t !            *************************************** \t!\n";
    cout<<"\t !            *   NewGenWatches management system   * \t!\n";
    cout<<"\t !            *************************************** \t!\n";
    cout<<"________________________________________________________________________________\n";
    cout<<"Choose Watch type:\n1.Analog\n2.Digital\n3.Smartwatch"<<endl;
    cin>>choiceofmenu;
    switch(choiceofmenu)
    {
    case 1:
    {
        while(choiceofmenu!=6)
        {
            analog.menu();
            cin>>choiceofmenu;
            if(choiceofmenu==1)//add record
            {
                analog.add(counterofanalog);
                counterofanalog++;
            }
            if(choiceofmenu==2)//delete record
            {
                cout<<"Enter watch ID of the watch that want to delete:";
                int tempid;//temporary id for delete record
                cin>>tempid;
                int x=analog.deletedata(tempid,counterofanalog);
                counterofanalog=x;
            }
            if(choiceofmenu==3)//edit reccord
            {
                int temid;
                cout<<"Enter watch id that you want to edit:";
                cin>>temid;//temporary id for edit record
                analog.editdetails(temid,counterofanalog);
            }
            if(choiceofmenu==4)//view record
                analog.view(counterofanalog);
            if(choiceofmenu==5)//exit
            {
                system("cls");
                goto AB;
            }
        }
    }
case 2:
    {
        while(choiceofmenu!=6)
        {
            digital.menu();
            cin>>choiceofmenu;
            if(choiceofmenu==1)//add record
            {
                digital.add(counterofdigital);
                counterofdigital++;
            }
            if(choiceofmenu==2)//delete record
            {
                cout<<"Enter watch ID of the watch that want to delete:";
                int tempid;//temporary id for delete record
                cin>>tempid;
                int x=digital.deletedata(tempid,counterofdigital);
                counterofdigital=x;
            }
            if(choiceofmenu==3)//edit reccord
            {
                int temid;//temporary id for edit record
                cin>>temid;
                digital.editdetails(temid,counterofdigital);
            }
            if(choiceofmenu==4)//view record
                digital.view(counterofdigital);
            if(choiceofmenu==5)//exit
            {
                system("cls");
                goto AB;
            }
        }
    }
case 3:
    {
        while(choiceofmenu!=6)
        {
            smartwatch.menu();
            cin>>choiceofmenu;
            if(choiceofmenu==1)//add record
            {
                smartwatch.add(counterofsmartwatch);
                counterofsmartwatch++;
            }
            if(choiceofmenu==2)//delete record
            {
                cout<<"Enter watch ID of the watch that want to delete:";
                int tempid;//temporary id for delete record
                cin>>tempid;
                int x=smartwatch.deletedata(tempid,counterofsmartwatch);
                counterofsmartwatch=x;
            }
            if(choiceofmenu==3)//edit reccord
            {
                int temid;//temporary id for edit record
                cin>>temid;
                smartwatch.editdetails(temid,counterofsmartwatch);
            }
            if(choiceofmenu==4)//view record
                smartwatch.view(counterofsmartwatch);
            if(choiceofmenu==5)//exit
            {
                system("cls");
                goto AB;
            }
        }
    }
default:
    {
     cout<<"Wrong input.\nPlease enter your choice again.\n"<<endl;
         system("pause");
         system("cls");
         goto AB;
     }
}
}

You are asking us to analyze 300+ lines of code, yet give no indication of what your problem is. Got $200 USD per hour for me to do that? My clients pay me that for similar services... :-(

@phoenix254 - Well, besides being very bad, and retro, goto's are allowed, even in C++, but VERY MUCH not recommended! And usually not needed in properly structured code. It is a lazy programmer's crutch. It is still allowed in order to preserve backward (good term that!) compatibility.

@phoenix254 - Well, besides being very bad, and retro, goto's are allowed, even in C++, but VERY MUCH not recommended! And usually not needed in properly structured code. It is a lazy programmer's crutch. It is still allowed in order to preserve backward (good term that!) compatibility.

2 month ago. i used go to in my school and teacher told me tht is forbidden since -1989.:)

This article has been dead for over six months. Start a new discussion instead.