• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts

基础知识1。功能的基本结构:

类型函数名(参数列表){

函数体,函数在return语句中终止。void类型函数可以不返回或写“return;”这样一句话

}

2.函数的调用:

使用函数名(参数),参数对应于参数表。

常识

常识:一百年是400的倍数,是闰年。比如1900年不是闰年。

小技巧

小贴士:

您可以使用一个空数组和一个累积变量来存储新生成的数据。

比如3360

声明: int new_num[10000],num _ cnt

存储新生成的数: new_num[ num_cnt]=新生成的数;

遍历所有新生成的数字:

for(int I=1;i=num _ cnti){

printf('%d\n ',new _ num);

}

代码# include bits/stdc . h

使用命名空间std

//使用judge函数判断某年是否是闰年。

//函数类型:bool函数名:判断参数列表:int num是闰年返回1(真),不是闰年返回0(假)

布尔法官(整数){

If(num% 100==0){ //先判断是不是百年。

if(num % 400==0)返回true//一百年需要模400等于0才是闰年。

否则返回false

}否则{

if(num % 4==0)返回true//不是百年,只有模4等于0

否则返回false

}

}

int num[10000],cnt

int main()

{

int x,y;scanf('%d%d ',x,y);

for(int I=x;I=y;I){//遍历从X到y的所有年份。

If(judge(i)){ //判断I年是否是闰年

num[CNT]=I;//如果是,使用一个技巧来存储它

}

}

coutcntendl

//使用技能输出

for(int I=1;i=cnti){

如果(我!=1)cout“”;

cout num

} coutendl

返回0;

}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now