Writing FunctionsIs_leapyeardetermines whether the argument is a leap year and returns if the argument is a leap year1, if not a leap year returns0. in the main function input year, the calling functionIs_leapyearto determine whether it is a leap year, depending on the outcomethe output of the year February has several days.
/* All rights reserved. * File name: Test.cpp * Chen Dani * Completion date: May 21, 2015 * Version number: v1.0 */#include <iostream>using namespace Std;int is_leapyear (in T m); Declaration of a leap year function int main () {int year; cin>>year; if (Is_leapyear (year) ==1) cout<<29<<endl; Else cout<<28<<endl; return 0;} int is_leapyear (int m) { if (m%4==0&&m%100!=0) | | m%400==0) return 1; else return 0;}
Experience: Speed up the pace, added up, and continue to work!!
C + + brush question--2710: function---leap year judgment