1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

C++ Program Print Calendar HELP

Discussion in 'C++' started by programmer c++, Jan 15, 2009.

  1. programmer c++

    programmer c++ New Member

    Joined:
    Jan 15, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    hey
    this programe print calender i need to complete
    can some body to help me please


    Code: Cpp
    Code:
    #include <iostream>
    #include <iomanip>
    using namespace std;
    //do not modify data types and consts
    enum weekDay {Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday};
    const enum weekDay d01y01m1430 = Monday;
    const char *weekDayStr[] = {"Sa", "Su", "Mo", "Tu", "We", "Th", "Fr"};
    const char *monthStr[] = {"Muharram", "Safar", "Rabi' Al-Awwal", "Rabi' Al-Akhir", "Jumada Al-Awwal", "Jumada Al-Akhir", "Rajab", "Sha'aban", "Ramadan", "Shawwal", "Dhu Al-Qi'da", "Dhu Al-Hijjah"};
    const int nDaysPerMonth1430[] = {29, 30, 30, 29, 29, 30, 29, 30, 29, 30, 29, 30};
    const int WEEKS = 5; // 5 weeks a month
    const int DAYS = 7;// 7 days a week
    const int MONTHS = 12; // 12 months a year
     
    // do not modify menu
    int menu() {
    int op;
    int m;
    do {
    m = 1;
    cout <<setfill('*')<<setw(80)<<'*'<<endl;
    cout <<'*'<<setfill(' ')<<setw(4)<<' '<<setw(66)<<left<<"Display Year" <<right<<setw(5)<<m++<<setw(4)<<'*'<<endl;
    cout <<'*'<<setfill(' ')<<setw(4)<<' '<<setw(66)<<left<<"Display Month" <<right<<setw(5)<<m++<<setw(4)<<'*'<<endl;
    cout <<'*'<<setfill(' ')<<setw(4)<<' '<<setw(66)<<left<<"Display Week" <<right<<setw(5)<<m++<<setw(4)<<'*'<<endl;
    cout <<'*'<<setfill(' ')<<setw(4)<<' '<<setw(66)<<left<<"Display Day" <<right<<setw(5)<<m++<<setw(4)<<'*'<<endl;
    cout <<'*'<<setfill(' ')<<setw(4)<<' '<<setw(66)<<left<<"Exit" <<right<<setw(5)<<m++<<setw(4)<<'*'<<endl;
    cout <<setfill('*')<<setw(80)<<'*'<<endl;
    cout<<setfill(' ');
    cin >> op;
    } while (op < 1 || op >= m);
    return op;
    }
     
    void fillDays(int days[WEEKS][DAYS][MONTHS]) { 
    // add code here
    }
    void displayYear(const int days[WEEKS][DAYS][MONTHS], int monthsPerRow) {
    // add code here
    }
    void displayMonth(int days[WEEKS][DAYS][MONTHS], int month) {
    // add code here
    }
    void displayWeek(int days[WEEKS][DAYS][MONTHS], int month, int week) {
    // add code here
    }
    void displayDay(int days[WEEKS][DAYS][MONTHS], int month, int day) {
    // add code here
    }
    // do not modify main
    int main() {
    int days[WEEKS][DAYS][MONTHS] = {{{0}}};
    int monthsPerRow = 1;
    int month;
    int week;
    int day;
    fillDays(days);
    do {
    int op = menu();
    switch (op) {
    case 1:
    cout <<"Display Year:"<<endl;
    do {
    cout <<"monthsPerRow (1-3) = ";
    cin >> monthsPerRow;
    } while (monthsPerRow < 0 || monthsPerRow > 3);
    displayYear(days, monthsPerRow);
    break;
    case 2:
    cout <<"Display Month"<<endl;
    do {
    cout <<"month (1-12) = ";
    cin >> month;
    } while (month < 1 || monthsPerRow > 12);
    displayMonth(days, month);
    break;
    case 3:
    cout <<"Display Week:"<<endl;
    do {
    cout <<"month (1-12) = ";
    cin >> month;
    } while (month < 1 || month > 12);
    do {
    cout <<"week (1-5) = ";
    cin >> week;
    } while (week < 1 || week > 5);
    displayWeek(days, month, week);
    break;
    case 4:
    cout <<"Display Day:"<<endl;
    do {
    cout <<"month (1-12) = ";
    cin >> month;
    } while (month < 1 || month > 12);
    do {
    cout <<"day (1-"<<nDaysPerMonth1430[month-1]<<") = ";
    cin >> day;
    } while (day < 1 || day > nDaysPerMonth1430[month-1]);
    displayDay(days, month, day);
    break;
    default:
    cout <<"Exit"<<endl;
    exit(0);
    }
    } while (1);
    return 0;
    }
     
    the print for program is same in the Attach Files


    thank you
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,285
    Likes Received:
    364
    Trophy Points:
    83
    There are so many things which you should take care of

    1. Post in the right forum and you posted it as an article.
    2. Do not post the same thing more than once.
    3. Do not post the complete code and say please complete it but try explaining what you can't do and what help you are looking for.
    4. Do not attach your code unless it is the only way out.
     
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Can't help you if we don't know what the problem is. Does the code do something wrong? What is it doing wrong and what did you expect it to do? Which line of code does the problem occur on? Do you provide any input to the program (and if so, what)?
     

Share This Page