I've built this up but it will not run completely. When executed the program promts the users for the questions then print nothing of the calendar.
this is my code so far.

//Izabella Pearson
//CIS 150
//Program 6


#include <iostream> //Header Files
#include <fstream>
#include <string>
#include <iomanip>

using namespace std;

    bool leapYear(int year)
        {
            if (year % 4 ==0)
            return true;
            else
            return false;
        }


int main()

{

    bool leapYear( int year);
    int DIW(int year);
    int DOW, year, month, day, MIY = 0;
    int FDOM;
    int mDays[]={ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
    int i = 0;
    bool r;
    int s;


cout<<"Enter a year"<<endl;
cin>>year;

    if( leapYear( year ) == true )
    {
        mDays[2] = 29;
    }



cout<<"Please enter the day of January 1st"<<endl;
cin>>day;

    //Determine where the first day begins

    day = 0;
    for (; FDOM < day; ++FDOM)

// Print this year's calendar



    for (int month = 0; month < 12; ++month)
{
    for (int i = 0; i < 12; ++i)
{
    cout << setw(3) << " ";
    if (month == 0)
    cout << "January \n";
    if (month == 1)
    cout << "February \n";
    if (month == 2)
    cout << "March \n";
    if (month == 3)
    cout << "April \n";
    if (month == 4)
    cout << "May \n";
    if (month == 5)
    cout << "June \n";
    if (month == 6)
    cout << "July \n";
    if (month == 7)
    cout << "August \n";
    if (month == 8)
    cout << "September \n";
    if (month == 9)
    cout << "October \n";
    if (month == 10)
    cout << "November \n";
    if (month == 11)
    cout << "December \n";

}
}

cout << " S M T W T F S \n" << endl;

    for (int i = 0; i < day; i++);

// Print this month's calendar
for (int mDay = 0; mDay < mDays[month]; ++mDay) {
cout << setw(3) << mDay + 1;
DOW++;
if (DOW == 7) {
cout << "\n" << setw(3);
DOW = 0;
}
// Set up for the next month
if (DOW != 7) {
cout << "\n";
}
cout << endl;
day = DOW + 1;

return 0; 
    }
}

line 52: FDOM hasn't been initialized to anything, so it just contains some random value.

What compiler are you using? Learn to use your compiler's debugger so that you can easily find the mistakes in your program.

This article has been dead for over six months. Start a new discussion instead.