I really don't know what the problems occurs inside this coding. I do not have any idea what this error means. If anybody can help me I would be so grateful.

#include<string>
#include<iostream>
#include<stdlib.h>
using namespace std;

int num=1;
int counterforanalog=0;
int counterfordigital=0;
int counterforsmartwatch=0;

class watch

private:
int watch_id;
string brand;
double price;
string colour;
int date;
public:
watch()
{
watch_id=0;
brand="";
price=0;
colour="";
date=0;
}

void adddata()
{
cout<<"Please Enter Watch ID:";
cin>>watch_id;
cin.ignore();
cout<<"Please Enter Watch Brand:";
getline(cin,brand);
cout<<"Please Enter Price: Rm ";
cin>>price;
cout<<"Please Enter Watch colour:";
getline(cin,colour);
cout<<"PLease enter date:";
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;
HD: cout<<"Do you want to continue editing?"<<end1;
cout<<"\t1:YES\t2:NO"<<endl;
cin>>a;
if(a==1)
{
cout<<"\nPlease Enter New Watch ID of the watch:"<<endl;
cin>>watch_id;
cout<<"\nPlease Enter New brand of the watch:"<<endl;
getline(cin,brand);
cout<<"\nPlease Enter New price of the watch:"<<endl;
cin>>price;
cout<<"Insert date today:"<<end1;
cin>>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<<"no\t"<<"id"<<"\t"<<"brand"<<"\t"<<"date"<<endl;
cout<<"no\t"<<"watch_id"<<"\t"<<"brand"<<"\t"<<"date"<<endl;
}
};

class stock
{
private:
int watch_listofwatch[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;
listofwatch_detail[count].adddata();
}
void view(int x)
{
int count=x;
num=1;
if(count==0)
{
cout<<"No record found"<<endl;
system("pause");
}
else
{
for(int d=0;d<count;d++)
{
listofwatch_detail[count].view();
num++;
}
system("pause");
}
}
void editdetails(int x,int y)
{
int count=y;
for(int a=0;a<count;a++)
{
if(listofwatch_detail[a].getID()==0)
{
cout<<"NO Record Found"<<endl;
system("pause");
break;
}
if(listofwatch_detail[a].getID()==x)
{
listofwatch_detail[a].editdetail();
break;
}
}
}
int deletedata(int y,int z)
{
int count=z;
for(int a=0;a<z;a++)
{
DE: if(listofwatch_detail[a].getID()==y)
{
int d=0;
listofwatch_detail[a].view();
cout<<"The record was deleted"<<endl;
z--;
return z;
break;
}

else if(a==z-1)
{
cout<<"NO record matched"<<endl;
system("pause");
goto DE;
}
}
}
};
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>>choiceofevent;
if(choiceofstock==1)
{
while(choiceofmenu!=6)
{
analog.menu();
cin>>choiceofmenu;
if(choicefmenu==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;//temporary id for edit record
cin>>temid;
analog.editdetails(temid,counterofanalog);
}
if(choiceofmenu==4)//view record
analog.view(counterofanalog);
if(choiceofmenu==5)//exit
{
system("cls");
goto AB;
}
}
}
else if(choiceofstock==2)
{
while(choiceofmenu!=6)
{
system("cls")
digital.menu();
cin>>choiceofmenu;
if(choicefmenu==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;
}
}
}
else if(choiceofstock==3)
{
while(choiceofmenu!=6)
{
system("cls")
smartwatch.menu();
cin>>choiceofmenu;
if(choicefmenu==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;
}
}
}
else
{
cout<<"Wrong input.\nPlease enter your choice again.\n"<<endl;
system("pause");
system("cls");
goto AB;
}
}

You're missing the opening brace for the watch class. This will highlight other errors:

Line 41: you have the wrong extraction operator it should be >>.

Lines 50 & 61: You put a 1 instead of an l at the end of endl.

Line 70: the label ED doesn't exist. Did you mean HD?

editdetail doesn't have a closing brace.

In the stock class you reference listofwatch_detail but it doesn't seem to exist.

That should get you started. main also needs checking it has numerous errors.

You should try to get away from using labels and goto. Anything you accomplish with those can be done in other, better ways. For instance the under the AB label can be encompassed in a while loop.

Also a switch block instead of the chained if blocks would improve readability.

Edited 1 Year Ago by tinstaafl

Thank you very much, tinstaafl. I will try to improve it~

This question has already been answered. Start a new discussion instead.