0

help in C++ regarding class and method

hello in the following code I want to add 1. "int Date::dayInYear() const" in order to compute the number of the day within the year in the range 1 to365 . 2. "int Date::operator -(const Date& d2) const"want to compute the difference in days between "this" and "d2" everything is ok except them code: https://code.sololearn.com/cdtxLCHOH02P/#cpp

10th Dec 2017, 5:28 PM
jjcopl
jjcopl - avatar
22 Answers
+ 1
wow thank you. let me try it out :)
10th Dec 2017, 7:00 PM
jjcopl
jjcopl - avatar
0
I do but I get nothing but some error, I fed up :|
10th Dec 2017, 6:08 PM
jjcopl
jjcopl - avatar
0
I didn't say that's my code, that's a very elegant code. If it makes you feel any better not to help, then just don't!
10th Dec 2017, 6:29 PM
jjcopl
jjcopl - avatar
0
If it isn't your code, you should comment where it came from. Using published code is fine, by you owe the author credit for their work with a comment stating where it came from. You won't learn if I write it. If we fix your code, you will understand better. I will help, but wish to see an effort on your part.
10th Dec 2017, 6:31 PM
John Wells
John Wells - avatar
0
it's my teacher's code. he gave to us to work on it. and I do. at least tell me where should I add my codes? it seems complicated for me
10th Dec 2017, 6:37 PM
jjcopl
jjcopl - avatar
0
what do you mean by coming?
10th Dec 2017, 6:47 PM
jjcopl
jjcopl - avatar
0
I added functions and commented algorithm https://code.sololearn.com/cNzdKnqJisYx/?ref=app
10th Dec 2017, 6:53 PM
John Wells
John Wells - avatar
0
how about this code for the first aim? const int Date::daysPerMonth[]{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; void Date::checkDate() { if (year < 1 || month < 1 || month > 12 || day < 1 || (day > daysPerMonth[month - 1] && !(day == 29 && month == 2 && isLeapYear(year)))) { day = month = 1; year = stdYear; } }
10th Dec 2017, 7:05 PM
jjcopl
jjcopl - avatar
0
you don't need all of it and can't call it because it doesn't return what you need.
10th Dec 2017, 7:08 PM
John Wells
John Wells - avatar
0
:| I feel stupid. would you please teach me programming?
10th Dec 2017, 7:15 PM
jjcopl
jjcopl - avatar
0
Sure. Stop posting here. I'll put a comment on your code and you reply there.
10th Dec 2017, 7:16 PM
John Wells
John Wells - avatar
0
thank you. but which code will you comment on? it's very kind of you
10th Dec 2017, 7:24 PM
jjcopl
jjcopl - avatar
0
yes you mean this one: https://code.sololearn.com/cNzdKnqJisYx/?ref=app#cpp I thought you are going to help me in order to learn to programme.
10th Dec 2017, 7:42 PM
jjcopl
jjcopl - avatar
0
can we share some contact information, please? talking on sololearn is really difficult.
10th Dec 2017, 7:50 PM
jjcopl
jjcopl - avatar
0
I could not find you pffffffffff can we talk on other easy and fast place/?
10th Dec 2017, 7:57 PM
jjcopl
jjcopl - avatar
- 1
So your asking for us to finish writing your code? Given what you've done, you shouldn't have issues finishing it. If you do, I'd gladly help fix it.
10th Dec 2017, 5:54 PM
John Wells
John Wells - avatar
- 1
It isn't in your code you linked. I'd like to help, but need to see your failed attempt.
10th Dec 2017, 6:11 PM
John Wells
John Wells - avatar
- 1
Coming
10th Dec 2017, 6:38 PM
John Wells
John Wells - avatar
- 1
I've already put two on yours
10th Dec 2017, 7:37 PM
John Wells
John Wells - avatar
- 1
You can't modify my code. We need to start with your version
10th Dec 2017, 7:44 PM
John Wells
John Wells - avatar