int _tmain(int argc, _TCHAR* argv[]) { char dayOfWeek, repeat; int lengthOfCall; double timeOfDay, costOfCall; do{ cout << "Input the day of the week (ex: Mo is Monday): "; cin >> dayOfWeek; cout << "Input the time the call starts in 24 hour format (1:30 = 13:30): "; cin >> timeOfDay; cout << "Input the length of call in minutes: "; cin >> lengthOfCall; if(dayOfWeek == 'Mo' || dayOfWeek == 'Tu' || dayOfWeek == 'We' || dayOfWeek == 'Th' || dayOfWeek == 'Fr'){ if(timeOfDay > 8:00 && timeOfDay < 18:00){ costOfCall = lengthOfCall * .4; } else if(timeOfDay < 8:00 && (timeOfDay > 18:00 && timeOfDay < 24:00)){ costOfCall = lengthOfCall * .25; } else{ cout << "You have not entered a valid time of day." << endl; } } else if(dayOfWeek == 'Sa' || dayOfWeek == 'Su'){ costOfCall = lengthOfCall * .15; } else{ cout << "You have not entered a valid day of the week." << endl; } cout << "The cost of your call will be: " << costOfCall << endl; cout << "Do you want to repeat this program? (enter Y or y): "; cin >> repeat; }while(repeat == 'Y' || repeat == 'y'); return 0; } |