1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include <iostream>
#include <string>
using namespace std;
#include "DaysOfYearClass.h"
int main() // loop this program for multiple inputs
{
// Create an instance of the DayOfYear class
DayOfYear dayOfYearObj;
int day; // To hold the day
int monthDays[12] = {31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365};
string months[12] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
// Display the purpose of the program.
cout << "This program converts a number \n"
<< "into a string representing the \n"
<< "month and day.\n\n";
// Get the day as input from the user.
cout << "\nEnter a whole number between 1 and 365: ";
cin >> day;
// Set the day.
dayOfYearObj.setDay(day);
// Display the object.
dayOfYearObj.print();
return 0;
}
|