954,505 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Calendar for programming one in c++

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
persianprez
Junior Poster in Training
97 posts since Oct 2006
Reputation Points: 10
Solved Threads: 1
 

>>Can someone please finish this off,

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

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

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.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 
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

persianprez
Junior Poster in Training
97 posts since Oct 2006
Reputation Points: 10
Solved Threads: 1
 

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
----------------------------------
WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 

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.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You