Lawlzes

Ch7_1.cpp

Oct 29th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include "Date.h"
  2. #include "Date.cpp"
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main()
  8. {
  9. int tempMonth = 0;
  10. int tempDay = 0;
  11. int tempYear = 0;
  12. int DaysPerMonth[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
  13.  
  14. cout << "Hello! This Program will Give You a Certain Date in 3 Different Formats\n\n";
  15.  
  16. while (tempMonth < 1 || tempMonth > 12)
  17.  
  18. {
  19.  
  20. cout << "Month: \n\n";
  21. cin >> tempMonth;
  22. cout << endl;
  23.  
  24. }
  25.  
  26. while (tempDay > DaysPerMonth[tempMonth - 1] || tempDay < 1)
  27.  
  28. {
  29.  
  30. cout << "Day: \n\n";
  31. cin >> tempDay;
  32. cout << endl;
  33.  
  34. }
  35. while (tempYear < 1)
  36.  
  37. {
  38.  
  39. cout << "Year: \n\n";
  40. cin >> tempYear;
  41. cout << endl;
  42.  
  43. }
  44.  
  45. Date *d = new Date(tempMonth, tempDay, tempYear);
  46. d->printDate1();
  47. d->printDate2();
  48. d->printDate3();
  49.  
  50. system("Pause");
  51.  
  52.  
  53. return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment