Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   program c++ print calender HELP (http://www.go4expert.com/forums/program-cpp-print-calender-help-t15830/)

programmer c++ 15Jan2009 19:45

program c++ print calender HELP
 
hey
this program print calender can some body help me to complete
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 of program is in the attach files

thank you

shabbir 15Jan2009 20:00

Re: program c++ print calender HELP
 
Duplicate of C++ Program Print Calendar HELP. Thread closed


All times are GMT +5.5. The time now is 04:43.