Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.81 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <ctime>
  4. #include <stdlib.h> //for exit() function
  5. #include <fstream> //for creating text file
  6. using namespace std;
  7. getch()
  8. int total = 0;
  9. int bookingNo = 0;
  10.  
  11. class Reservation{
  12. private:
  13. int bookingNo;
  14. string name;
  15. int phoneNo;
  16. int paxNo;
  17. int day;
  18. int month;
  19. int year;
  20. int time;
  21. int date;
  22. long dateAndTime;
  23. public:
  24. Reservation(){
  25. bookingNo = 1;
  26. name = "Tan Phit Huan";
  27. phoneNo = 0123456777;
  28. paxNo = 1;
  29. day = 1;
  30. month = 1;
  31. year = 2019;
  32. time = 1500;
  33. date = 20190101;
  34. dateAndTime = 201910201649;
  35. }
  36. Reservation(int bNo, string na, int phNo, int pxNo, int d, int mon, int y, int t,int da, long dNt){
  37. bookingNo = bNo;
  38. name = na;
  39. phoneNo = phNo;
  40. paxNo = pxNo;
  41. day = d;
  42. month = mon;
  43. year = y;
  44. time = t;
  45. date = da;
  46. dateAndTime =dNt;
  47. }
  48. void setBookingNo(int bNo){
  49. bookingNo = bNo;
  50. }
  51. int getBookingNo(){
  52. return bookingNo;
  53. }
  54. void setName(string na){
  55. name = na;
  56. }
  57. string getName(){
  58. return name;
  59. }
  60. void setPhoneNo(int phNo){
  61. phoneNo = phNo;
  62. }
  63. int getPhoneNo(){
  64. return phoneNo;
  65. }
  66. void setPaxNo(int pxNo){
  67. paxNo = pxNo;
  68. }
  69. int getPaxNo(){
  70. return paxNo;
  71. }
  72. void setDay(int d){
  73. day = d;
  74. }
  75. int getDay(){
  76. return day;
  77. }
  78. void setMonth(int m){
  79. month = m;
  80. }
  81. int getMonth(){
  82. return month;
  83. }
  84. void setYear(int y){
  85. year = y;
  86. }
  87. int getYear(){
  88. return year;
  89. }
  90. void setTime(int t){
  91. time = t;
  92. }
  93. int getTime(){
  94. return time;
  95. }
  96. void setDate(int da){
  97. date = da;
  98. }
  99. int getDate(){
  100. return date;
  101. }
  102. void setDateAndTime(long dNt){
  103. dateAndTime = dNt;
  104. }
  105. long getDateAndTime(){
  106. return dateAndTime;
  107. }
  108. };
  109.  
  110. class linklist{
  111. private:
  112. struct node{
  113. Reservation info;
  114. node *link;
  115. }*head;
  116.  
  117. public:
  118. linklist(){
  119. head=NULL;
  120. }
  121.  
  122. void InsNewNode(int bNo, string na, int phNo, int pxNo, int d, int mon, int y, int t, long dNt){
  123. node*newNode = new node;
  124. node*p,*q = head;
  125. newNode -> info.setBookingNo(bNo);
  126. newNode -> info.setName(na);
  127. newNode -> info.setPhoneNo(phNo);
  128. newNode -> info.setPaxNo(pxNo);
  129. newNode -> info.setDay(d);
  130. newNode -> info.setMonth(mon);
  131. newNode -> info.setYear(y);
  132. newNode -> info.setTime(t);
  133. newNode -> info.setDateAndTime(dNt);
  134.  
  135. //If no records
  136. if (head == NULL){
  137. head = newNode;
  138. return;
  139. }
  140.  
  141. //Insert at the start of list
  142. if (head -> info.getDateAndTime() > newNode -> info.getDateAndTime()){
  143. newNode -> link = head;
  144. head = newNode;
  145. return;
  146. }
  147.  
  148. while(q->info.getDateAndTime() < newNode -> info.getDateAndTime() && q->link != NULL){
  149. p = q;
  150. q = q->link;
  151. }
  152. //Insert at the end of the list
  153. if(q == NULL){
  154. q = newNode;
  155. newNode-> link = NULL;
  156. return;
  157. //Insert in the middle of the list
  158. }else{
  159. p = q;
  160. q = q->link;
  161. p->link = newNode;
  162. newNode-> link = q;
  163. return;
  164. }
  165. }
  166.  
  167. void deleteNode(int bNo){
  168. node *current;
  169. current = head;
  170. while (current != NULL){
  171. if(bNo == current->info.getBookingNo()){
  172. if(current == head){
  173. node*temp = head;
  174. head = head -> link;
  175. delete temp;
  176.  
  177. }else if(current->link == NULL){
  178. node*p, *q = head;
  179. while(q -> link != NULL){
  180. p = q;
  181. q = q -> link;
  182. }
  183. p->link = NULL;
  184. delete q;
  185.  
  186. }else{
  187. node*p, *q = head;
  188. while(q -> info.getBookingNo() != bNo){
  189. p = q;
  190. q = q -> link;
  191. }
  192. p -> link = q ->link;
  193. delete q;
  194. }
  195. }
  196. current = current->link;
  197. }
  198. total--;
  199. }
  200.  
  201. void PrintList(){
  202. node *current;
  203. current = head;
  204. cout<<setfill(' ')<<setw(5)<<"| No. "
  205. <<left<<setw(30)<<"Name"
  206. <<setw(5)<<"Phone No."
  207. <<right<<setw(16)<<"Pax No."
  208. <<setw(10)<<"Date"
  209. <<setw(16)<<"Time |"<<endl
  210. <<"|"<<right<<setfill('=')<<setw(86)<<"|"<<endl;
  211.  
  212. while (current != NULL){
  213. cout<<"| "<<setfill(' ')<<current->info.getBookingNo()<<" "
  214. <<left<<setw(30)<< current->info.getName()
  215. <<right<<setw(10)<<setfill('0')<< current->info.getPhoneNo()
  216. <<setw(12)<<setfill(' ')<< current->info.getPaxNo()<<setw(6)<<setfill(' ')<<" "
  217. <<setw(2)<<setfill('0')<< current->info.getDay() <<"/"<<setw(2)<<setfill('0')<< current->info.getMonth() <<"/"<<setw(4)<<setfill('0')<< current->info.getYear()<<setw(7)<<setfill(' ')<<" "
  218. <<setw(4)<<setfill('0')<< current->info.getTime() <<" |"<<endl;
  219. current = current->link;
  220. }
  221. cout<<endl;
  222. }
  223.  
  224. void PrintBookingNoRecords(int bNo){
  225. node *current;
  226. current = head;
  227. cout<<setfill(' ')<<setw(5)<<"| No. "
  228. <<left<<setw(30)<<"Name"
  229. <<setw(5)<<"Phone No."
  230. <<right<<setw(16)<<"Pax No."
  231. <<setw(10)<<"Date"
  232. <<setw(16)<<"Time |"<<endl
  233. <<"|"<<right<<setfill('=')<<setw(86)<<"|"<<endl;
  234.  
  235. while (current != NULL){
  236. //If there is any reservation with the same name
  237. if(bNo == current->info.getBookingNo()){
  238. cout<<"| "<<setfill(' ')<<current->info.getBookingNo()<<" "
  239. <<left<<setw(30)<< current->info.getName()
  240. <<right<<setw(10)<<setfill('0')<< current->info.getPhoneNo()
  241. <<setw(12)<<setfill(' ')<< current->info.getPaxNo()<<setw(6)<<setfill(' ')<<" "
  242. <<setw(2)<<setfill('0')<< current->info.getDay() <<"/"<<setw(2)<<setfill('0')<< current->info.getMonth() <<"/"<<setw(4)<<setfill('0')<< current->info.getYear()<<setw(7)<<setfill(' ')<<" "
  243. <<setw(4)<<setfill('0')<< current->info.getTime() <<" |"<<endl;
  244. }
  245. current = current->link;
  246. }
  247. cout<<endl;
  248. }
  249.  
  250. void PrintNameRecords(string name){
  251. node *current;
  252. current = head;
  253. cout<<setfill(' ')<<setw(5)<<"| No. "
  254. <<left<<setw(30)<<"Name"
  255. <<setw(5)<<"Phone No."
  256. <<right<<setw(16)<<"Pax No."
  257. <<setw(10)<<"Date"
  258. <<setw(16)<<"Time |"<<endl
  259. <<"|"<<right<<setfill('=')<<setw(86)<<"|"<<endl;
  260.  
  261. while (current != NULL){
  262. //If there is any reservation with the same name
  263. if(name == current->info.getName()){
  264. cout<<"| "<<setfill(' ')<<current->info.getBookingNo()<<" "
  265. <<left<<setw(30)<< current->info.getName()
  266. <<right<<setw(10)<<setfill('0')<< current->info.getPhoneNo()
  267. <<setw(12)<<setfill(' ')<< current->info.getPaxNo()<<setw(6)<<setfill(' ')<<" "
  268. <<setw(2)<<setfill('0')<< current->info.getDay() <<"/"<<setw(2)<<setfill('0')<< current->info.getMonth() <<"/"<<setw(4)<<setfill('0')<< current->info.getYear()<<setw(7)<<setfill(' ')<<" "
  269. <<setw(4)<<setfill('0')<< current->info.getTime() <<" |"<<endl;
  270. }
  271. current = current->link;
  272. }
  273. cout<<endl;
  274. }
  275.  
  276. void PrintDateRecords(int date){
  277. node *current;
  278. current = head;
  279. cout<<setfill(' ')<<setw(5)<<"| No. "
  280. <<left<<setw(30)<<"Name"
  281. <<setw(5)<<"Phone No."
  282. <<right<<setw(16)<<"Pax No."
  283. <<setw(10)<<"Date"
  284. <<setw(16)<<"Time |"<<endl
  285. <<"|"<<right<<setfill('=')<<setw(86)<<"|"<<endl;
  286.  
  287. while (current != NULL){
  288. //If there is any reservation with the same date
  289. if(date == current->info.getDate()){
  290. cout<<"| "<<setfill(' ')<<current->info.getBookingNo()<<" "
  291. <<left<<setw(30)<< current->info.getName()
  292. <<right<<setw(10)<<setfill('0')<< current->info.getPhoneNo()
  293. <<setw(12)<<setfill(' ')<< current->info.getPaxNo()<<setw(6)<<setfill(' ')<<" "
  294. <<setw(2)<<setfill('0')<< current->info.getDay() <<"/"<<setw(2)<<setfill('0')<< current->info.getMonth() <<"/"<<setw(4)<<setfill('0')<< current->info.getYear()<<setw(7)<<setfill(' ')<<" "
  295. <<setw(4)<<setfill('0')<< current->info.getTime() <<" |"<<endl;
  296. }
  297. current = current->link;
  298. }
  299. cout<<endl;
  300. }
  301.  
  302. void PrintListTextFile(){
  303. string fileName;
  304. int count = 0;
  305. cout << "---------------=CREATE TEXT FILE=---------------" << endl;
  306. //Create file with the file name user entered
  307. cout << "Enter file name: ";
  308. cin >> fileName;
  309. cout << "Your .txt file can be found in the same folder where your .cpp file is saved." << endl;
  310. fileName = fileName + ".txt";
  311.  
  312. //output to .txt file
  313. ofstream file(fileName.c_str());
  314.  
  315. if (file.is_open()) {
  316. //output all the reservation records
  317. node *current;
  318. current = head;
  319. file<<setfill(' ')<<setw(5)<<"| No. "
  320. <<left<<setw(30)<<"Name"
  321. <<setw(5)<<"Phone No."
  322. <<right<<setw(16)<<"Pax No."
  323. <<setw(10)<<"Date"
  324. <<setw(16)<<"Time |"<<endl
  325. <<"|"<<right<<setfill('=')<<setw(86)<<"|"<<endl;
  326.  
  327. while (current != NULL){
  328. count++;
  329. file<<"| "<<setfill(' ')<<count<<" "
  330. <<left<<setw(30)<< current->info.getName()
  331. <<right<<setw(10)<<setfill('0')<< current->info.getPhoneNo()
  332. <<setw(12)<<setfill(' ')<< current->info.getPaxNo()<<setw(6)<<setfill(' ')<<" "
  333. <<setw(2)<<setfill('0')<< current->info.getDay() <<"/"<<setw(2)<<setfill('0')<< current->info.getMonth() <<"/"<<setw(4)<<setfill('0')<< current->info.getYear()<<setw(7)<<setfill(' ')<<" "
  334. <<setw(4)<<setfill('0')<< current->info.getTime() <<" |"<<endl;
  335. current = current->link;
  336. }
  337. file.close(); //close file
  338. }
  339. }
  340.  
  341. bool checker(int bNo){
  342. node *current;
  343. current = head;
  344. while(current != NULL){
  345. if(bNo == current->info.getBookingNo()){
  346. return true;
  347. }
  348. current = current->link;
  349. }
  350. return false;
  351. }
  352. // ~linklist(){
  353. // node *q;
  354. // if(head == NULL){
  355. // return;
  356. // }
  357. // while( head != NULL ){
  358. // q = head->link;
  359. // delete head;
  360. // head = q;
  361. // }
  362. // }
  363. };
  364.  
  365. linklist RList;
  366. void addRecord();
  367. void updateRecord();
  368. void deleteRecord();
  369. void viewRecord();
  370. void createTextFile();
  371. bool checkYear();
  372. bool checkMonth();
  373.  
  374.  
  375. int main() {
  376. int choice;
  377. cout << "===============RESTAURANT RESERVATION SYSTEM===============" << endl;
  378. cout << "Please enter your selection" << endl <<
  379. "1. Add Reservation Records" << endl <<
  380. "2. Update Reservation Records" << endl <<
  381. "3. Delete Reservation Records" << endl <<
  382. "4. View Reservation Records " << endl <<
  383. "5. Create text file" << endl <<
  384. "6. Exit" << endl;
  385.  
  386. cout << "Choice: ";
  387. cin >> choice;
  388. cin.clear();
  389. cin.ignore(1, '\n');
  390. system("CLS");
  391.  
  392. switch (choice) {
  393. //Add Records
  394. case 1:
  395. addRecord();
  396. break;
  397.  
  398. //Update Records
  399. case 2:
  400. if (total == 0) {
  401. cout << "No reservation records available." << endl;
  402. main();
  403. }
  404. updateRecord();
  405.  
  406. break;
  407.  
  408. //Delete Records
  409. case 3:
  410. if (total == 0) {
  411. cout << "No reservation records available." << endl;
  412. main();
  413. }
  414. deleteRecord();
  415.  
  416. break;
  417.  
  418. //View Reservation Records
  419. case 4:
  420. if (total == 0) {
  421. cout << "No reservation records available." << endl;
  422. main();
  423. }
  424. viewRecord();
  425. break;
  426.  
  427. //Create Text File
  428. case 5:
  429. if (total == 0) {
  430. cout << "No reservation records available." << endl;
  431. main();
  432. }
  433. createTextFile();
  434. break;
  435.  
  436. case 6:
  437. exit(1);
  438. break;
  439.  
  440. default:
  441. cout << choice << " is not valid choice" << endl;
  442. main();
  443. }
  444.  
  445. return 0;
  446. }
  447.  
  448. //OPTION 1 : Add Reservation Records
  449. void addRecord(){
  450. string name;
  451. int phoneNo, paxNo, day, month, year, time;
  452. long dateAndTime;
  453. cout << "-----------------=ADD RECORD=-------------------" << endl;
  454. cout<<"Enter name : ";
  455. getline(cin, name);
  456.  
  457. cout<<"Enter phone No. (e.g : 0123456789) : ";
  458. cin>>phoneNo;
  459.  
  460. cout<<"Enter pax No. : ";
  461. cin>>paxNo;
  462.  
  463. cout<<"Enter year (e.g : 2019) : ";
  464. cin>>year;
  465.  
  466. cout<<"Enter month (e.g : January = 1) : ";
  467. cin>>month;
  468.  
  469. cout<<"Enter day : ";
  470. cin>>day;
  471.  
  472. cout<<"Enter time in 24hr format (e.g : 3.30pm = 1530) : ";
  473. cin>>time;
  474.  
  475. bookingNo++;
  476. cout<<"Booking Number : "<<bookingNo<<endl;
  477.  
  478. //for inserting the node in order according to date and time
  479. dateAndTime = year*100000000 + month*1000000 + day*10000 + time;
  480.  
  481. RList.InsNewNode(bookingNo, name, phoneNo, paxNo, day, month, year, time, dateAndTime);
  482. total++;
  483. cin.clear();
  484. cin.ignore(1000, '\n');
  485. cout << "Press enter to continue . . .";
  486. getch();
  487. system("CLS");
  488. main();
  489. }
  490.  
  491. //OPTION 2 : Update Reservation Records
  492. void updateRecord(){
  493. string name;
  494. int bNo, phoneNo, paxNo, day, month, year, time;
  495. long dateAndTime;
  496. cout << "----------------=UPDATE RECORD=-----------------" << endl;
  497. cout << "Enter Booking Number : ";
  498. cin >> bNo;
  499.  
  500. if(RList.checker(bNo)){
  501. RList.PrintBookingNoRecords(bNo);
  502. RList.deleteNode(bNo);
  503.  
  504. cin.clear();
  505. cin.ignore(1000,'\n');
  506.  
  507. cout<<"Enter name : ";
  508. getline(cin, name);
  509.  
  510. cout<<"Enter phone No. (e.g : 0123456789) : ";
  511. cin>>phoneNo;
  512.  
  513. cout<<"Enter pax No. : ";
  514. cin>>paxNo;
  515.  
  516. cout<<"Enter year (e.g : 2019) : ";
  517. cin>>year;
  518.  
  519. cout<<"Enter month (e.g : January = 1) : ";
  520. cin>>month;
  521.  
  522. cout<<"Enter day : ";
  523. cin>>day;
  524.  
  525. cout<<"Enter time in 24hr format (e.g : 3.30pm = 1530) : ";
  526. cin>>time;
  527.  
  528. //for inserting the node in order
  529. dateAndTime = year*100000000 + month*1000000 + day*10000 + time;
  530.  
  531. RList.InsNewNode(bNo, name, phoneNo, paxNo, day, month, year, time, dateAndTime);
  532. cout<<"Update process complete."<<endl;
  533. }else{
  534. cout<<"No existing record with that booking number."<<endl
  535. <<"Update process cancelled."<<endl;
  536. }
  537.  
  538. cin.clear();
  539. cin.ignore(1000, '\n');
  540. cout << "Press enter to continue . . .";
  541. getch();
  542. system("CLS");
  543. main();
  544. }
  545.  
  546. //OPTION 3 : Delete Reservation Records
  547. void deleteRecord(){
  548. int bNo;
  549. char confirm;
  550. cout << "----------------=DELETE RECORD=-----------------" << endl;
  551. cout<<"Enter Booking Number : ";
  552. cin>>bNo;
  553. if(RList.checker(bNo)){
  554. RList.PrintBookingNoRecords(bNo);
  555. cout<<"Confirm?(y/n) : ";
  556. cin>>confirm;
  557.  
  558. switch (confirm) {
  559. case 'y':
  560. RList.deleteNode(bNo);
  561. cout<<"Deletion process complete."<<endl;
  562. break;
  563. default:
  564. cout<<"Deletion process cancelled."<<endl;
  565. main();
  566. }
  567. }else{
  568. cout<<"No existing record with that booking number."<<endl;
  569. }
  570.  
  571. cin.clear();
  572. cin.ignore(1000, '\n');
  573. cout << "Press enter to continue . . .";
  574. getch();
  575. system("CLS");
  576. main();
  577. }
  578.  
  579. //OPTION 4 : View Reservation Records
  580. void viewRecord(){
  581. int choice;
  582. string name;
  583. int bNo, year, month, day, date;
  584. cout << "-----------------=VIEW RECORD=------------------" << endl;
  585. cout << "Please enter your selection" << endl <<
  586. "1. View All Reservations" << endl <<
  587. "2. Search by Booking Number"<< endl <<
  588. "3. Search by Name" << endl<<
  589. "4. Search by Date"<< endl <<
  590. "5. Back to Main Menu"<< endl;
  591. cout << "Choice: ";
  592. cin >> choice;
  593. cin.clear();
  594. cin.ignore(1, '\n');
  595. system("CLS");
  596.  
  597. switch (choice) {
  598. //View All Reservations
  599. case 1:
  600. RList.PrintList();
  601. break;
  602.  
  603. case 2:
  604. cout<<"Enter Booking Number : ";
  605. cin>>bNo;
  606. RList.PrintBookingNoRecords(bNo);
  607. break;
  608.  
  609. //Search by Name
  610. case 3:
  611. cout<<"Enter Name : ";
  612. getline(cin, name);
  613.  
  614. RList.PrintNameRecords(name);
  615. break;
  616.  
  617. case 4:
  618. cout<<"Enter year (e.g : 2019) : ";
  619. cin>>year;
  620.  
  621. cout<<"Enter month (e.g : January = 1) : ";
  622. cin>>month;
  623.  
  624. cout<<"Enter day : ";
  625. cin>>day;
  626.  
  627. date = year*10000 + month*100 + day;
  628.  
  629.  
  630. break;
  631.  
  632. case 5:
  633. main();
  634. break;
  635.  
  636. default:
  637. cout << choice << " is not valid choice" << endl;
  638. viewRecord();
  639. }
  640.  
  641. cout << "Press enter to continue . . .";
  642. getch();
  643. system("CLS");
  644. main();
  645. }
  646.  
  647. //OPTION 5 : Create Text File
  648. void createTextFile(){
  649. RList.PrintListTextFile();
  650. getch();
  651. cout << "-----------------------------------------------------" << endl;
  652.  
  653. cout << "Press enter to continue . . .";
  654. cin.clear();
  655. cin.ignore(1000, '\n');
  656. system("CLS");
  657. main();
  658. }
  659.  
  660. //for getting the current time
  661. time_t now = time(0);
  662. tm *ltm = localtime(&now);
  663.  
  664. int currentYear = 1900+ltm->tm_year;
  665. int currentMonth = 1 + ltm->tm_mon;
  666. int currentDay = ltm->tm_mday;
  667. int currentHour = ltm->tm_hour;
  668. int currentMinute = ltm->tm_min;
  669.  
  670. bool checkYear(int year){
  671. if(year < currentYear){
  672. cout<<"Can't go back in time!"<<endl;
  673. return false;
  674. }else{
  675. return true;
  676. }
  677. }
  678.  
  679. bool checkMonth(int month, int year){
  680. if(month < currentMonth && year == currentYear){
  681. cout<<"Can't go back in time!"<<endl;
  682. return false;
  683. }else if(month > 12){
  684. cout<<"There are only 12 months in a year!"<<endl;
  685. }else{
  686. return true;
  687. }
  688. }
  689.  
  690. bool checkDay(int day, int month, int year){
  691. if(day < currentDay && month == currentMonth && year == currentYear){
  692. cout<<"Can't go back in time!"<<endl;
  693. //even months
  694. }else if(month%2 == 0){
  695. // if the month is february
  696. if(month == 2){
  697. //february in common year that contain 28 days
  698. if(year%4 != 0 && day>28){
  699. cout << "Please key in between the day from 1 to 28"<< endl;
  700. }
  701. // february in leap year that contain 29 days
  702. else if(year%4 == 0 && day>29){
  703. cout << "Please key in between the day from 1 to 29"<< endl;
  704. }
  705. else{
  706. return true;
  707. }
  708. }
  709. // month that are even with 31 days
  710. else if(month > 7 && day > 31){
  711. cout << "Please key in between the day from 1 to 31"<< endl;
  712. }
  713. // month that are even with 30 days
  714. else if(month < 7 && day > 30){
  715. cout << "Please key in between the day from 1 to 30"<< endl;
  716. }
  717. else{
  718. return true;
  719. }
  720.  
  721. // month is odd
  722. }else if(month%2 != 0){
  723. // month that are odd with 30 days
  724. if(month>8 && day > 30){
  725. cout << "Please key in between the day from 1 to 30"<< endl;
  726. // month that are odd with 31 days
  727. }else if(month<8 && day > 31){
  728. cout << "Please key in between the day from 1 to 31"<< endl;
  729. }else{
  730. return true;
  731. }
  732. }
  733. else{
  734. return true;
  735. }
  736. return false;
  737. }
  738.  
  739. bool checkTime(int time, int day, int month, int year){
  740. int hour = time/100;
  741. int minute = time - hour*100;
  742.  
  743. if(hour > 24){
  744. cout<<"Only 0 to 24 hours."<<endl;
  745. return false;
  746. }else if(hour < currentHour){
  747. cout<<"Can't go back in time!"<<endl;
  748. return false;
  749. }else{
  750. return true;
  751. }
  752.  
  753. if(minute > 60){
  754. cout<<"Only 0 to 60 minutes."<<endl;
  755. }else if(minute < currentMinute){
  756. cout<<"Can't go back in time!"<<endl;
  757. }else{
  758. return true;
  759. }
  760. return false;
  761. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement