Friday, November 3, 2017

Total Days To Year, Weeks and Days Converter in C++

In this article I would like to share with you a sample program that will ask the user to give the total number of days and then our program will count the number of years, weeks and days on the given total days using C++ as our programming language.

I am currently accepting programming work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.






Sample Program Output


Program Listing

#include <iostream>

using namespace std;

int main()
{
    int no_days=0, years=0, weeks=0,days=0;

    cout << "\t Total Days To Year, Weeks and Days Converter in C++";
    cout << "\n\n";
    cout << "Created By Mr. Jake R. Pomperada, MAED-IT";
    cout << "\n\n";
    cout << "How many total days : ";
    cin >> no_days;

    years = (no_days/365);
    weeks = (no_days % 365) / 7;
    days  = (no_days % 365) % 7;

    cout << "\n\n";
    cout << no_days << " Days " << years << " year(s) "
         << weeks << " weeks "<< days  << " days " << ".";
    cout << "\n\n";
    cout << "End of Program.";
    cout << "\n\n";

}


No comments:

Post a Comment