Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //OPTION 2 : Update Reservation Records
- void updateRecord(){
- string name;
- int bNo, phoneNo, paxNo, day, month, year, time, date;
- int correct = 1;
- cout << "----------------=UPDATE RECORD=-----------------" << endl;
- cout<<"Enter 0 to return to main menu."<<endl;
- cout << "Enter Booking Number : ";
- cin >> bNo;
- if(bNo == 0){
- cout << "Press enter to continue . . .";
- getchar();
- system("CLS");
- main();
- }
- if(RBList.checker(bNo)){
- RBList.PrintBookingNoRecords(bNo);
- RBList.deleteNode(bNo);
- cin.clear();
- cin.ignore(1000, '\n');
- do{
- cout<<"Enter name : ";
- getline(cin, name);
- }while(!checkName(name));
- if(name=="0"){
- cout << "Press enter to continue . . .";
- getchar();
- system("CLS");
- main();
- }
- cout<<endl<<"Enter phone number (e.g : 0123456789) : ";
- cin>>phoneNo;
- correct = 1;
- while (correct == 1){
- if (cin.fail() || phoneNo<0 || checkNoOfDigits(phoneNo)>10){
- cin.clear();
- cin.ignore();
- cout << "Invalid input! Enter positive numbers (maximum 11 digits)!" << endl<<endl;
- cout<< "Enter phone number (e.g : 0123456789) : ";
- cin >> phoneNo;
- }else{
- correct = 0;
- }
- }
- correct = 1;
- cout<<endl<<"Enter number of pax (maximum : 50) : ";
- cin>>paxNo;
- while (correct == 1){
- if (cin.fail() || paxNo<=0 || paxNo > 50){
- cin.clear();
- cin.ignore();
- cout << "Invalid input! Enter positive numbers (max : 50 , min : 1)!" << endl<<endl;
- cout<< "Enter number of pax (maximum : 50) : ";
- cin >> paxNo;
- }else{
- correct = 0;
- }
- }
- do{
- correct = 1;
- cout<<endl<<"Enter year (e.g : 2019): ";
- cin>>year;
- while (correct == 1){
- if (cin.fail() || year > 2021){
- cin.clear();
- cin.ignore();
- cout << "Invalid input! Enter numbers (maximum year is 2021)!" << endl<<endl;
- cout<< "Enter year (e.g : 2019) : ";
- cin >> year;
- //reset if a year before 2019 was entered then 2022 or later is entered
- }else{
- correct = 0;
- }
- }
- }while(!checkYear(year));
- do{
- correct = 1;
- cout<<endl<<"Enter month (e.g : January = 1) : ";
- cin>>month;
- while (correct == 1){
- if (cin.fail()){
- cin.clear();
- cin.ignore();
- cout << "Invalid input! Enter numbers!" << endl<<endl;
- cout<< "Enter month (e.g : January = 1) : ";
- cin >> month;
- }else{
- correct = 0;
- }
- }
- }while(!checkMonth(month, year));
- do{
- correct = 1;
- cout<<endl<<"Enter day : ";
- cin>>day;
- while (correct == 1){
- if (cin.fail()){
- cin.clear();
- cin.ignore();
- cout << "Invalid input! Enter numbers!" << endl<<endl;
- cout<< "Enter day : ";
- cin >> day;
- }else{
- correct = 0;
- }
- }
- }while(!checkDay(day, month, year));
- do{
- correct = 1;
- cout<<endl<<"Enter time in 24hr format (e.g : 3.30pm = 1530) : ";
- cin>>time;
- while (correct == 1){
- if (cin.fail()){
- cin.clear();
- cin.ignore();
- cout << "Invalid input! Enter positive numbers (maximum 4 digits)!" << endl<<endl;
- cout<< "Enter time in 24hr format (e.g : 3.30pm = 1530) : ";
- cin >> time;
- }else{
- correct = 0;
- }
- }
- }while(!checkTime(time, day, month, year));
- //for finding the reservation by date
- date = year*10000 + month*100 + day;
- RBList.InsNewNodeByBookNo(bNo, name, phoneNo, paxNo, day, month, year, time, date);
- cout<<"Update process complete."<<endl;
- }else{
- cout<<"No existing record with that booking number."<<endl
- <<"Update process cancelled."<<endl;
- }
- cin.clear();
- cin.ignore(1000, '\n');
- cout << "Press enter to continue . . .";
- getchar();
- system("CLS");
- main();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement