CPPForSchool.com: Variable, Operator & Expression Set 2: Assignment 5

5. Write a program which accepts days as integer and display total number of years, months and days in it.
For example :  If user input as 856 days the output should be 2 years 4 months 6 days



This assignment is a great example of how the learning process is built on prior knowledge.  Assignment 3 demonstrated how to utilize the modulo operator.  For this assignment, I utilized it once more in order to properly break down the number of days that the user inputs.  With that said, here is my source code.


First, I tested the program using the example days amount, specifically 856.  Luckily, it resulted in the same output as the example.




However, it comes to reason for me to test it once more.  Viola!  It works!



Comments

Popular posts from this blog

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 9

CPPForSchool.com: Array - Single Dimension Set 1 Assignment 6

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 8