Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int MAX_HHMM = 5;
- const int MAX_DAY = 2;
- void call_input(char time_of_call[]);
- void time_text(bool start_or_finish);
- void day_of(char day_of_week[]);
- int main()
- {
- char start_of_call[MAX_HHMM + 1];
- char end_of_call[MAX_HHMM + 1];
- char day_of_week[MAX_DAY + 1];
- cout << "This program will calculate long distance\n"
- << "-----------------------------------------\n\n";
- time_text(true);
- call_input(start_of_call);
- time_text(false);
- call_input(end_of_call);
- day_of(day_of_week);
- return 0;
- }
- void day_of(char day_of_week[])
- {
- cout << "\nEnter a date"
- << "in the format of"
- << "\n Mon Tue Wed Thu Fri Sat Sun > ";
- cin >> day_of_week;
- day_of_week[sizeof(day_of_week) -1] = '\0';
- return;
- }
- void call_input(char time_of_call[])
- {
- char yes_or_no[4] = "no";
- cin >> time_of_call;
- time_of_call[sizeof(time_of_call) - 1] = '\0';
- while(yes_or_no[0] != 'y' && yes_or_no[1] != 'e' && yes_or_no[2] !='s') {
- cout << "\nYour time was " << time_of_call
- << "\nIs this correct > ";
- cin >> yes_or_no;
- yes_or_no[sizeof(yes_or_no) -1] = '\0';
- if(yes_or_no[0] != 'y' && yes_or_no[1] !='e' && yes_or_no[2] !='s') {
- cout << "Enter the time again > ";
- cin >> time_of_call;
- time_of_call[sizeof(time_of_call) - 1] = '\0';
- }
- }
- return;
- }
- void time_text(bool start_or_finish)
- {
- if (start_or_finish == true) {
- cout << "enter the time your call started HH:MM > ";
- }
- if (start_or_finish == false) {
- cout << "enter the time your call ended HH:MM > ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement