Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- string leap(int y)
- {
- if (y % 100 == 0 && y % 400 == 0)
- {
- return "leap";
- }
- else if (y % 100 == 0 && y % 400 != 0)
- {
- return "not leap";
- }
- else if (y % 4 == 0)
- {
- return "leap";
- }
- else if (y % 4 != 0)
- {
- return "not leap";
- }
- else return "error";
- }
- int main()
- {
- int y;
- cout << " Insert a year: \n";
- cin >> y;
- cout << " Year is: \n " << leap(y) <<"\n";
- cout << " Insert a year: \n";
- cin >> y;
- cout << " Year is: \n " << leap(y) << "\n";
- cout << " Insert a year: \n";
- cin >> y;
- cout << " Year is: \n " << leap(y) << "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement