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
22 Respuestas
+ 1
wow thank you. let me try it out :)
0
I do but I get nothing but some error, I fed up :|
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!
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.
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
0
what do you mean by coming?
0
I added functions and commented algorithm
https://code.sololearn.com/cNzdKnqJisYx/?ref=app
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;
}
}
0
you don't need all of it and can't call it because it doesn't return what you need.
0
:| I feel stupid.
would you please teach me programming?
0
Sure. Stop posting here. I'll put a comment on your code and you reply there.
0
thank you. but which code will you comment on?
it's very kind of you
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.
0
can we share some contact information, please?
talking on sololearn is really difficult.
0
I could not find you
pffffffffff
can we talk on other easy and fast place/?
- 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.
- 1
It isn't in your code you linked. I'd like to help, but need to see your failed attempt.
- 1
Coming
- 1
I've already put two on yours
- 1
You can't modify my code. We need to start with your version