Created
          April 17, 2011 21:15 
        
      - 
      
 - 
        
Save lazypower/924477 to your computer and use it in GitHub Desktop.  
  
    
      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
    
  
  
    
  | #include <iostream> | |
| #include <string> | |
| using namespace std; | |
| #include "person.h" | |
| int menuSelection; | |
| void drawDiamonds() | |
| { | |
| cout << " * * * * * " << endl; | |
| cout << "*** *** *** *** ***" << endl; | |
| cout << " * * * * * " << endl; | |
| } | |
| void displayMenu() | |
| { | |
| drawDiamonds(); | |
| cout << "(1) Enter your name" << endl; | |
| cout << "(2) Enter your birthdate" << endl; | |
| cout << "(3) Menu Entry three" << endl; | |
| cout << "(4) Menu Entry four" << endl; | |
| drawDiamonds(); | |
| cout << endl; | |
| cout << "Enter a menu selection (-1 to quit): "; | |
| cin >> menuSelection; | |
| } | |
| int main() | |
| { | |
| // define: the current user : todo : allow for multiple person's | |
| Person myperson(); | |
| while (menuSelection != -1 ) | |
| { | |
| displayMenu(); | |
| if (menuSelection == 1) | |
| { | |
| string foo; | |
| cout << "Enter your name: "; | |
| cin >> foo; | |
| myperson.setName(foo); | |
| } | |
| } | |
| return 0; | |
| } | 
  
    
      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
    
  
  
    
  | #include <iostream> | |
| #include <string> | |
| #include <sstream> | |
| #include <iomanip> | |
| using namespace std; | |
| #include "person.h" | |
| void Person::setName(string aName) | |
| { | |
| name = aName; | |
| } | |
| void Person::setBirthDate() | |
| { | |
| cout << "What day were you born? " << endl; | |
| cin >> day; | |
| cout << "What month were you born? " << endl; | |
| cin >> month; | |
| cout << "What year were you born? " << endl; | |
| cin >> year; | |
| } | |
| int Person::getDay() | |
| { | |
| return day; | |
| } | |
| int Person::getMonth() | |
| { | |
| return month; | |
| } | |
| int Person::getYear() | |
| { | |
| return year; | |
| } | |
| void Person::printDate() | |
| { | |
| cout << month << "/" << day << "/" << year; | |
| } | 
  
    
      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
    
  
  
    
  | #include <iostream> | |
| #include <string> | |
| using namespace std; | |
| class Person | |
| { | |
| public: | |
| void setDate(); | |
| string getDate(); | |
| void setName(string); | |
| int getYear(); | |
| int getMonth(); | |
| int getDay(); | |
| void printDate(); | |
| void setBirthDate(); | |
| private: | |
| int day; | |
| int month; | |
| int year; | |
| string name; | |
| }; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment