Saturday, February 21, 2015

Leap Year Lister in C++

In this article I would like to share with you my simple program written in C++ I called this program Leap Year Lister in C++. This program uses structure data structure in C++ and one dimensional array to accept ten items of year from the user. After the user type all ten item our program will check and determine if the given year is a leap year or not a leap year. The code is very simple and easy to understand for beginners in C++ programming.

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



Sample Output of Our Program


Program Listing

#include <iostream>

using namespace std;

struct leap_year {
   
    int year[10];
};



 main()
{
leap_year years;

cout << "LEAP YEAR LISTER IN C++";
cout << "\n\n";

for (int a=0; a<10; a++) {   
cout << "Enter year no. " << a+1 << " : ";
cin >> years.year[a];
}
for (int a=0; a<10; a++) { 
     
if(years.year[a] %4==0) {
cout << "\n\n";
cout << years.year[a] << " is a Leap Year.";
}
else {
cout << "\n";
cout << years.year[a] << " is Not a Leap Year";
  }
}
cout << "\n\n";
system("pause");
}



No comments:

Post a Comment