I can't do the edit function, delete and transaction. and something's problem in my view function.. NEED HELP PLEASE
#include<iostream>
#include<cstdlib>
#include<string.h>
#include<fstream>
#include<iostream>
#include<conio.h>
int choice;
while (choice !=0){
system("cls");
system("color 03");
cout<<"***Main Window***"<<endl;
cout<<"1.Add Record"<<endl;
cout<<"2.Edit Record"<<endl;
cout<<"3.View Record"<<endl;
cout<<"4.Delete Record"<<endl;
cout<<"5.Transaction"<<endl;
cout<<"0.Exit"<<endl;
cout<<"Enter your choice:";
cin>>choice;
if (choice>5 || choice<0) return 0;
else
switch (choice){
case 1:addrecord();
break;
case 2:editrecord();
break;
case 3:viewrecord();
break;
case 4:deleterecord();
break;
system("PAUSE");
return EXIT_SUCCESS;
}}}
void addrecord(){
string empcode,fname,pos,bpay,cuscode,emprecord;
int choice;
string cat;
int connum;
string procode;
string d;
int p;
while (choice !=0){
system("cls");
if (choice==1)
cout<<"***Add Record***"<<endl;
cout<<"1.Employee"<<endl;
cout<<"2.Customer"<<endl;
cout<<"3.Product"<<endl;
cout<<"0.Back to Main Window"<<endl;
cout<<"Enter your choice:";
cin>>choice;
if (choice==1){
switch (choice){
case 1:employee;
system("cls");
cout<<"1.Employee Code:";
cin>>empcode;
cout<<"Fullname:";
getline(cin,fname);
getline(cin,fname);
cout<<"Position:";
getline(cin,pos);
cout<<"Basic Pay:";
getline(cin,bpay);
ofstream newemp;
newemp.open("emprecord.txt",ios::app);
if (newemp.is_open())
newemp<<empcode<<","<<fname<<","<<pos<<","<<bpay<<endl;
else{
cout<<"Error! Writing to a file failed.";
exit(1);}
newemp.close();
break;}}
if (choice==2){
switch (choice){
case 2:customer;
system("cls");
cout<<"1.Customer Code:";
cin>>cuscode;
cout<<"Fullname:";
getline(cin,fname);
getline(cin,fname);
cout<<"Category:";
cin>>cat;
cout<<"Contact Number:";
cin>>connum;
ofstream newcus;
newcus.open("cusrecord.txt",ios::app);
if (newcus.is_open())
newcus<<cuscode<<","<<fname<<","<<cat<<","<<connum<<endl;
else{
cout<<"Error! Writing to a file failed.";
exit(1);}
newcus.close();
break;}}
if (choice==3){
switch (choice){
case 3:product;
system("cls");
cout<<"1.Product Code:";
cin>>procode;
cout<<"Description:";
getline(cin,d);
getline(cin,d);
cout<<"Price:";
cin>>p;
ofstream newpro;
newpro.open("prorecord.txt",ios::app);
if (newpro.is_open())
newpro<<procode<<","<<d<<","<<p<<endl;
else{
cout<<"Error! Writing to a file failed.";
exit(1);}
newpro.close();
break;}}
}system("pause");}
void editrecord(){
ofstream newemp;
newemp.open("emprecord.txt");
string empcode,fname,pos,bpay,cuscode;
int choice;
string cat;
int connum;
string procode;
string d;
int p;
while (choice !=0){
system("cls");
if (choice==2)
cout<<"***Edit Record***"<<endl;
cout<<"1.Employee"<<endl;
cout<<"2.Customer"<<endl;
cout<<"3.Product"<<endl;
cout<<"0.Back to Main Window"<<endl;
cout<<"Enter your choice:";
cin>>choice;
if (choice==1){
int temp_empcode;
int temp_cuscode;
int temp_procode;
int choice;
system("cls");
cout<<"***Delete Record***"<<endl;
cout<<"1.Employee"<<endl;
cout<<"2.Customer"<<endl;
cout<<"3.Product"<<endl;
cout<<"0.Back to main window"<<endl;
cout<<"Enter your choice:";
cin>>choice;
system("cls");
if (choice==1)
switch(choice){
case 1: employee;
cout<<"Enter employee code to be deleted: ";
cin>>temp_empcode;
break;}
system("cls");
if (choice==2)
switch(choice){
case 2: customer;
cout<<"Enter customer code to be deleted: ";
cin>>temp_cuscode;
break;}
system("cls");
if (choice==3)
switch(choice){
case 3: product;
cout<<"Enter product code to be deleted: ";
cin>>temp_procode;
break;}