For a portion of my code, I need to either input a date from user or capture the system date. From there onwards I have to add 7 more days to the actual date and store it as the variable 'DueDate'. The format for the stored DueDate is DDMMYY. I am very confused as I am facing a lot of problems.
System time, seems very confusing and I cant get it to work, so I decided to stick to the traditional - "Let the user input the date" method.
Problems I need to tackle:
1. Output the DueDate in the correct format. Even if I meddle around with the input values as integers, I cant output in the correct format, for example - if the user enters "1" for month, I can not display it as "01" (and i need it to be 01 since that is the required format). How can i do that?
2. The logic I have applied for the date (like, incrementing month, if the due date exceeds number of days in month, or incrementing the year if month in duedate exceeds number of months in a year) is very troublesome.
Please help.
I wouldn't mind altering my code to use system time if it is less troublesome. I prefer neat coding in my programs.
Thanks for the quick reply, Disch! Appreciate it. :)
1. But how do I set an integer in place of a blank space. I mean if i setw(2) then it'll output as "_7". How can I set the blank as an integer like 0, which will then solve my problem.
2. Yeah. I will consider the lookup table idea. Thanks.