Can someone please finish this off, i need the days to start going on
the day specified

#include <iostream.h>
int main()
{
    int month;//asks for current month
    int days;//asks for day of start
    int numdays;//number of days in the month
    int monthstarter=1; //starts day count
    

    cout<<"Enter a month (1 - 12): ";
    cin>>month;
    cout<<"Enter a starting day (0 for Sunday, 1 for Monday...): ";
    cin>>days;
    
    if (month==1){
        cout<<"\t\tJanuary"<<endl;
        numdays=31;
    }//end if
    else if (month==2){
        cout<<"\t\tFebuary"<<endl;
        numdays=28;
    }//end else if
    else if (month==3){
        cout<<"\t\tMarch"<<endl;
        numdays=31;
    }//end else if
    else if (month==4){
        cout<<"\t\tApril"<<endl;
        numdays=30;
    }//end else if
    else if (month==5){
        cout<<"\t\tMay"<<endl;
        numdays=31;
    }//end else if
    else if (month==6){
        cout<<"\t\tJune"<<endl;
        numdays=30;
    }//end else if
    else if (month==7){
        cout<<"\t\tJuly"<<endl;
        numdays=31;
    }//end else if
    else if (month==8){
        cout<<"\t\tAugust"<<endl;
        numdays=31;
    }//end else if
    else if (month==9){
        cout<<"\t\tSeptember"<<endl;
        numdays=30;
    }//end else if
    else if (month==10){
        cout<<"\t\tOctober"<<endl;
        numdays=31;

    }//end else if
    else if (month==11){
        cout<<"\t\tNovember"<<endl;
        numdays=30;
    }//end else if
    else if (month==12){
        cout<<"\t\tDecember"<<endl;
        numdays=31;
    }//end else if


    
    cout<<"\tS  M  T  W  T  F  S"<<endl;
    cout<<"----------------------------------"<<endl;
    
    cout.setf(ios::right);
    cout.width(2);
    
    

    return 0;
}//end main body

Recommended Answers

All 9 Replies

>>Can someone please finish this off,

No, we don't do your homework for you.

Hmm.. buddy, just post the kind of error you are getting or the way your program is supposed to work and is not working or atleast some indication which will tell us whta you need to know.
You are very vague in your question.

Hmm.. buddy, just post the kind of error you are getting or the way your program is supposed to work and is not working or atleast some indication which will tell us whta you need to know.
You are very vague in your question.

I can only get the week and month displayed by user input, i cant get the numbered days to start going that depend on the month

Telling us to finish the hard part just by doing the easy part doesn't qualify as you showing your effort in this problem. But for the time being, explain the expected output for these inputs.

Enter a month (1 - 12): 2
Enter a starting day (0 for Sunday, 1 for Monday...): 1
                Febuary
        S  M  T  W  T  F  S
----------------------------------

Here is one I found on the net using google -- use it at your own risk because it contains a couple bugs, but otherwise I think it is what you want.

how about month year days ,make sure to take a leap year need some answer here ...

how about month year days

What about it?

anyone??

Don't be so impatient, people are probably busy with their lives doing other things. Don't expect immediate answers on forums.

After 5 years, we figure the thread is dead so we don't have to jump on if. Now if you asked a proper question by starting your own thread you'd probably get a good response.

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.