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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
#include "CinReader.h"
#include <vector>
#include <string>
using namespace std;
CinReader reader;
struct entry
{
string day;
string event;
};
struct month
{
int year;
string months;
int firstDayinmo;
vector<entry> thismonth;
int dinmo;
};
void newJournal(month a[], int size);
void viewEdit (month a[], int size);
void ess(month a[], int size);
void printMonth (month a);
void centerstring(string& buff);
void clearScreen ();
void save (month a[], int size);
//void getJournal (month a[], int size);
//int monthCheck(int month,int year, month a[12]);
int main()
{
const int miny = 12;
month year[miny];
//int rows = 6;
//int days = 7;
//int array [rows][days];
cout << "Would you like to create a new Journal or work on an existing one?\n"
<< "1. Start new Journal\n"
<< "2. Work on existing one.\n";
int userchoice = reader.readInt(1,2);
switch (userchoice)
{
case 1:
newJournal(year, miny);
cout << year[4].year << year[4].months << year[4].dinmo << year[4].firstDayinmo;
//ess(year, miny);
break;
case 2:
//getJournal(year);
//ess();
break;
}
return 0;
}
void newJournal(month a[], int size)
{
int firstDaysinmo[12] = {12,8,8,11,13,9,11,7,10,12,8,10};
int daysInmonth[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
string monthset[12] = {"January","Febuary","March","April","May","June","July","August","September","October","November","December"};
string dayofweek[7] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
cout << "Please tell me what year it is.\n";
int useryear = reader.readInt(2010,2020);
for (int i = 0; i < size; i++)
{
a[i].year = useryear;
a[i].months = monthset[i];
a[i].dinmo = daysInmonth[i];
a[i].firstDayinmo = firstDaysinmo[i];
for (int j = 0; j < daysInmonth[i]; j++)
{
entry e;
e.day = dayofweek [((firstDaysinmo [i] + (j))%7)];
e.event = "empty";
a[i].thismonth.push_back(e);
}
}
}
|