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.
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
Post a Comment