Created
June 26, 2009 01:24
-
-
Save sms420/136265 to your computer and use it in GitHub Desktop.
realSimpleClockProgram
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //realSimpleClockProgram.cpp | |
| //for KT Monda and his crazy experiment | |
| #include <iostream> | |
| #include <ctime> | |
| using namespace std; | |
| void do_again(),direction(int ans); | |
| void option_1(),option_2(),; | |
| int main() | |
| { | |
| do_again();//call do_again function, say goodbye to main until everything else is done running | |
| return 0; | |
| }//end function | |
| void do_again() | |
| { | |
| int ans;//declare ans variable, this will be used OVER AND OVER | |
| do | |
| { | |
| cout << "What would you like to do?\n"; | |
| cout << "1: Option 1\n"; | |
| cout << "2: Option 2\n"; | |
| cout << "3: Option 3 - Exit\n";//print us some options | |
| cin >> ans; | |
| cin.ignore(80,'\n'); //take in an answer | |
| direction(ans);//send that answer to direction! | |
| }while(ans!=3);//keep on keepin on till they pick exit! | |
| }//end function | |
| void direction(int ans) | |
| { | |
| switch (ans)//roll thru options | |
| { | |
| case 1: //if they picked the number 1, its gonna go to this function, | |
| //thats pretty much how the whole thing works | |
| option_1(); | |
| break; | |
| case 2: | |
| option_2(); | |
| break; | |
| case 3: | |
| cout << "adios.\n"; | |
| break; | |
| default://THEY DIDNT READ THE MENU, WHO WOULD HAVE THOUGHT?!?! | |
| cout << "Please read and follow all directions\n";//if directions aren't followed | |
| break; | |
| } | |
| }//end function | |
| //functions, FILL WITH VALUABLE PROGRAMMING SKILLS | |
| void option_1() | |
| { | |
| cout<< "1: " << clock() << endl; | |
| }//end function | |
| void option_2() | |
| { | |
| cout<< "2: " << clock() << endl; | |
| }//end function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment