Hello.
I've searched your archives and found a similar question to mine and although I found your replies useful I am now stuck.
I am doing a project call NEWDAY using a pass by reference where I have to:
Write a function named NEWDAY using 3 parameters for month, day and year. ND has to increment the date represented by month,day and year.
Also have to write a main program which inputs a date (m,d,y) from keyboard and calls the NEWDAY in a loop in order to display the next 10 dates following input date. Main prog. handles all input/output.
This is what I have so far but it's not right and I am stuck as to how to proceed:
This is due tomorrow and I've worked many, many hours on this and I am just lost. I'm not asking anyone to fix this, just point me in the right direction, pretty please? Thank you so much.
#include <iostream>
using namespace std;
void NEWDAY (int&, int&, int&);
int main ()
{
int day=1, month=1, year, n;
cout<<"Enter a month (1-12): ";
cin>>month;
cout<<"Enter a day (1-31): ";
cin>>day;
cout<<"Enter year (yyyy): ";
cin>>year;
cout<<"The next ten days are: " <<endl;
for (n=0; n<=10; n++)
{
NEWDAY(month, day, year);
cout<<month <<"/" <<day <<"/" <<year <<endl;
}
system ("pause");
return 0;
}
void NEWDAY (int& d, int&m, int&y)
{
When I run this using 12/31/2009 it gives me 1/1/2010...1/1/2011 etc. So obviously I do not need the y++ because it is incrementing years and not days.
I'm sorry, I have no idea how I would even use code tags for this program. I am terribly programming illiterate and after taking this class I will leave it to those that truly understand it. :)
If my program is a jumbled mess I apologize and I understand that it will be impossible to help me. Please forgive my ignorance.
I understand /* stuff */
becomes
/* stuff */
(I did go and read the article)
But, my ignorance is that I do not know what you want me to [code]. What parts of the program? Thanks again for your patience and assistance.
No. He means put the code you have there, inside the [code] tags
EDIT: I haven't looked at your code because it is not within [code]tags but in answer to your leap question just do 'year % 4. If it returns 0 it is a leap year.
Yes, that's it. The indentation is weird though; why are all of the curly braces outdented as much as possible?
And I would try running it through a debugger to see exactly what the variables are at certain points. You will probably be able to figure out what the error is using only that.