Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //File: timeApp.cpp
- //Author: Derek Acker
- //Date: Spring 2012
- //Course: CSC 136
- //Description:
- #include<cstdlib>
- #include<iostream>
- #include"myTime.h"
- using namespace std;
- int getChoice(int& choice);
- myTime getTime();
- void displayMil(myTime time);
- void displayStd(myTime stdTime);
- myTime changeTime(myTime &time);
- myTime checkTime(myTime time, myTime nextTime);
- int main()
- {
- int choice;
- myTime theTime, nextTime;
- while((choice = getChoice(choice))!=6)
- {
- switch (choice)
- {
- case 1: theTime = getTime(); break;
- case 2: displayMil(theTime); break;
- case 3: displayStd(theTime); break;
- case 4: changeTime(theTime); break;
- case 5: checkTime(theTime, nextTime); break;
- }
- }
- system("PAUSE");
- return 0;
- }
- int getChoice(int& choice)
- {
- cout << "1. Enter a time" << endl;
- cout << "2. Display as 24 hour time" << endl;
- cout << "3. Display as 12 hour time" << endl;
- cout << "4. Change time" << endl;
- cout << "5. Check earlier" << endl;
- cout << "6. Quit" << endl;
- cout << "Choice: ";
- cin >> choice;
- while (choice < 1 || choice > 6)
- {
- cout << "You must enter a number between 1 and 6." << endl;
- cout << "Please enter your option again: ";
- cin >> choice;
- }
- return choice;
- }
- myTime getTime()
- {
- myTime time;
- cout << "Enter time ex: 12:45" << endl;
- cin >> time;
- return time;
- }
- void displayMil(myTime time)
- {
- cout << time << endl;
- }
- void displayStd(myTime stdTime)
- {
- stdTime.showClock();
- }
- myTime changeTime(myTime &time)
- {
- int min, hour;
- cout << "Enter minutes to be changed: " << endl;
- cin >> min;
- time.setMinutes(min);
- cout << "Enter hours the be changed: " << endl;
- cin >> hour;
- time.setHours(hour);
- }
- myTime checkTime(myTime time, myTime nextTime)
- {
- }
Add Comment
Please, Sign In to add comment