This challenge is ( large and easy ) at the same time ..

Those who accept this challenge and want to join the fun and interest,

We Will take The Best first Program ,, and he will be The " WiNnEr",

================================================

Description
The aim of this project is to develop a program hcal (similar to the unix cal program) to display the calendar Year .
of 2009. In this program, we can do the following operations:
1- Display the calendar of the year (2009)
2- Display a given month of the calendar
3- Display a week of a given month of the calendar
4- Display a day of a given month of the calendar .

================================================

Global types and constants:
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[] = {"Jan", "fib"... etc };
const int nDaysPerMonth2009[] ={ ... }
const int WEEKS = 5; // 5 weeks a month
const int DAYS = 7; // 7 days a week
const int MONTHS = 12; // 12 months a year
Local variable to the main function:
int days[WEEKS][DAYS][MONTHS]; // 5 weeks a month, 7 days a week, 12 months a year
Description of functions to be implemented
· void fillDays(int days[WEEKS][DAYS][MONTHS]); // 2 pts
This function fills the 3-D array with proper days. Columns represent days of the
week (7 columns: 0 for Saturday and 6 for Friday), rows represent weeks of the
month (5 rows: 0 for week number 1 and 4 for week number 5), and blocks represent
months (12 blocks: 0 for month 1 and 11 for month 12).
The following table represents block 0 (5 rows (weeks) x 7 columns (days)) for
the first month Jan . For example, 10 Jan is Wednesday of the second
week of the month.
Warning: You should use 3 nested loops to fill days (do not fill them one by one
by using 354 assignments). The same warning is valid for remaining display
functions where you should use loops.

================================================

· void displayYear(const int days[WEEKS][DAYS][MONTHS], int monthsPerRow); // 2 pts
Takes the 3-D array filled by the function fillDays as first argument and the
number of months to display per row. Notice that the order of months is from
right to left. For example, if monthsPerRow is 3 the program should have the
following output:
{ Cal of 2009 }

================================================
· void displayMonth(const int days[WEEKS][DAYS][MONTHS], int month); // 2 pts
Takes the 3-D array filled by the function fillDays as first argument and the
month to be displayed as second argument. For example, if month is 1 the program
should have the following output:
{ One Month }
================================================
· void displayWeek(const int days[WEEKS][DAYS][MONTHS],int month, int week);//2 pts
Takes the 3-D array filled by the function fillDays as first argument, the month
of the week to be displayed as second argument, and the week to be displayed. For
example, if month is 1 and week is 2, the program should have the following
output:
{ ONE WEEK }
================================================

· void displayDay(const int days[WEEKS][DAYS][MONTHS], int month, int day);// 2 pts
Takes the 3-D array filled by the function fillDays as first argument, the month
of the day to be displayed as second argument, and the day to be displayed. For
example, if month is 1 and day is 10, the program should have the following
output:
{
Fr Th We Tu Mo Su Sa
10
} For Ex <<

================================================


OK .. Lets goooooooooooooooooooooooooo;

who IS THe First And The Best ,,

Recommended Answers

All 6 Replies

The challenge is for dim-wits like you to come up with a half-decent attempt at doing their own homework.

Or at least come up with a better way of disguising the fact that it is homework.

Fact is, so far, you've failed miserably at both of them.

If it is a H.W why I Ask u ,, I can do it with my self ,,

don't be poring ,,, do it plz . or let other do

commented: What? -1
commented: Learn English -2

And I quote you the same post I made to you when you posted this exact thread on PFO:

Lol. I coded it already; took me 2 minutes and I don't even know C++. No, but seriously, nobody is going to do your homework for you. This is about as pathetic an attempt as I've ever seen.

ok .. correct me

#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);
getchar();getchar();
return 0;
}

And even that looks like something the instructor gave you. With the "do not modify" and "add code here" comments:

commented: Points for due diligence - I just saw the mess and moved on +27
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.