Tuesday, March 17, 2015

Count Years or Weeks in a given days in C++

In this article I would like to share with you a sample program that I wrote using C++ I called this program Count Years or Weeks  in a given days Using C++. The code is very simple by the use of simple formulas I hope you will find my work useful in your programming assignments and projects in C++.

If you have some questions please send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com

People here in the Philippines who wish to contact me can reach me at my mobile number 09173084360



Program Lisitng

#include <iostream>
#include <stdlib.h>

using namespace std;

int main()
{

 int years=0,days=0,weeks=0,solve=0;
 char reply;
 do {
 system("cls");
 cout << "\n==================================================";
 cout << "\n||  COUNT NO. OF YEARS OR WEEK IN A GIVEN DAY   ||";
 cout << "\n==================================================";
 cout << "\n\n";
 cout<<"ENTER NUMBER OF DAYS :=> ";
 cin>>days;
 years = days/365;
 solve=days-(years*365);
 weeks=days/7;
 solve=days-(weeks*7);

  cout << "\n\n";
  cout << "\n=========================";
  cout << "\n||  DISPLAY RESULTS    ||";
  cout << "\n=========================";
  cout << "\n\n";
  cout<<years << " Year(s) or " << weeks << " Week(s).";
  cout << "\n\n";
  cout << "Do you want to continue y/n :=> ";
  cin >> reply;
 } while (toupper(reply)=='Y');
  cout << "\n\n";
  cout << "======  THANK YOU FOR USING THIS PROGRAM =====";
  cout << "\n\n";
}


DOWNLOAD SOURCE CODE HERE



No comments:

Post a Comment