C++ days between dates | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C++ days between dates

HI, fairly new to coding in general and wanting to know the best way to have the date added into my program. What I ideally would like is the program to tell how many days between 2 specific dates. I've had a search and saw something called struct but not really too sure on that yet if thats the route I need to follow? Thanks

28th Jan 2020, 6:51 PM
Alan Jack
4 Answers
+ 2
Are you trying to solve that one code coach task? You don't have to hurry with these! If you don't clearly see the solution yet, you can first try an easier one. Most important is that *you* solve it. Because solving problems, getting stuff done, is *the* skill you need to build!
28th Jan 2020, 11:33 PM
HonFu
HonFu - avatar
0
why don't you show your code so that other coders can best compliment it by showing you what you need to do
28th Jan 2020, 6:56 PM
✳AsterisK✳
✳AsterisK✳ - avatar
0
I think it can be easily done without using structs or classes. You just need two integers - the day and the month. The rest is just maths.
28th Jan 2020, 7:19 PM
Misha Rogoza
Misha Rogoza - avatar
0
The code I have isn't much right now wouldn't help I think but I'm basically trying to do a calculator that would work out employees holiday entitlement so I will need to input dates so I can make the user select a holiday year say the holiday year is 1st January till 31st December. I will also need to be able to input dates for the employee start date. I would then need to calculate the number of days between the colleague start date and the end of holiday year (31st Dec) If that helps at all?
28th Jan 2020, 7:35 PM
Alan Jack