简单地用星号和空格构造以下圣诞树:
#includeusing namespace std;
int main()
{
int i=-1,H=0,x=0;
for (;i<=5;)
{
x=(++i+1<<1<<1)-(1<<(1<<1))+1;
for (int j=1;j<=(1<<1<<1)+((i&1)<<1);j++)
{
x=(H=(i==5?(i=5):0))?H:x;
for (int k=0;k<=16+32;k++) putchar((24-k)>x||(k-24)>x?0x20:0x2A);
putchar(0x0A);
x+=(j%2==0)+(j%4==0)+2;
}
}
getchar();
}
第五步:代码艺术化与数字替代#includeint i=-1,H=0,x=0,j;
//32=(1<<(10>>1))+((1<<(10>>1)>>1))
//16=(1<<(10>>1))+((1<<(10>>1)>>1))>>1
int main()
{
for (;i<=(1<<1<<1)+1;)
{
x=(++i+1<<1<<1)-(1<<(1<<1))+(j=1);
for (;j<=(1<<1<<1)+((i&1)<<1);)
{
x=(H=i==((1<<1<<1)+1)?(i=(1<<1<<1)+1):0)?H:x;
for (int k=0;k<=(1<<(10>>1))+((1<<(10>>1)>>1));k++) std::putchar((((1<<(10>>1))+((1<<(10>>1)>>1))>>1)-k)>x||(k-((1<<(10>>1))+((1<<(10>>1)>>1))>>1))>x?0x20:0x2A);std::putchar(0x0A);
x+=(j%(1<<1)==0)+(j++%(1<<1+1)==0)+(1<<1);
}
}
getchar();
}
第六步:将变量名替换为纯下划线是的,一个下划线、两个下划线到五个下划线,它们是五个不同的变量。
然后就变成了这样:
#includeint _=-1,_____,____,__,___;
int main()
{
for (;_<=(1<<1<<1)+1;)
{
__=(++_+1<<1<<1)-(1<<(1<<1))+(___=1);
for (;___<=(1<<1<<1)+((_&1)<<1);)
{
__=(_____=_==((1<<1<<1)+1)?(_=(1<<1<<1)+1):0)?_____:__;
for (;____<=(1<<(10>>1))+((1<<(10>>1)>>1));____++) std::putchar((((1<<(10>>1))+((1<<(10>>1)>>1))>>1)-____)>__||(____-((1<<(10>>1))+((1<<(10>>1)>>1))>>1))>__?0x20:0x2A);std::putchar(0x0A);
__+=(___%(1<<1)==0)+(___++%(1<<1+1)==0)+(1<<1)+(____=0);
}
}
std::getchar();
}
第七步:函数名与保留字替换通过预编译指令#define将main、int、getchar之类的单词都替换为意义不明的奇怪东西。
效果如下:
#define _O_ getchar
#define OO putchar
#define O_O main
#define OOO std
#define O int
#includeO _____,__,___,____,_=-1;
O O_O()
{
for (;_<=(1<<1<<1)+1;)
{
__=(++_+1<<1<<1)-(1<<(1<<1))+(___=1);
for (;___<=(1<<1<<1)+((_&1)<<1);)
{
__=(_____=_==((1<<1<<1)+1)?(_=(1<<1<<1)+1):0)?_____:__;
for (;____<=(1<<(10>>1))+((1<<(10>>1)>>1));____++) OOO::OO((((1<<(10>>1))+((1<<(10>>1)>>1))>>1)-____)>__||(____-((1<<(10>>1))+((1<<(10>>1)>>1))>>1))>__?0x20:0x2A);OOO::OO(0x0A);
__+=(___%(1<<1)==0)+(___++%(1<<1+1)==0)+(1<<1)+(____=0);
}
}
_O_();
}
第八步:快乐压行#define _O_ getchar
#define OO putchar
#define O_O main
#define OOO std
#define O int
#includeO _____,__, ___,____,_=-1;O O_O(){for (;_<=(1<<1<<1)+1;){__=(++_+1<<1<<1)-(1<<(1<<1))+(___=1);for (;___<=(1<<1<<1)+((_&1)<<1);){__=(_____=_==((1<<1<<1)+1)?(_=(1<<1<<1)+1):0)?_____:__;for (;____<=(1<<(10>>1))+((1<<(10>>1)>>1));____++) OOO::OO((((1<<(10>>1))+((1<<(10>>1)>>1))>>1)-____)>__||(____-((1<<(10>>1))+((1<<(10>>1)>>1))>>1))>__?0x20:0x2A);OOO::OO(0x0A);__+=(___%(1<<1)==0)+(___++%(1<<1+1)==0)+(1<<1)+(____=0);}}_O_();}
大部分空格和换行都不影响编译,C++真好!
第九步:拼个爱心(代码在这里)这一步花了一些时间,多调整了几次。
//This is for my best friend LYX.
#define _O_ getchar
#define OO putchar
#define O_O main
#define OOO std
#define O int
#include O _____,__, ___,____,
_=-1;O O_O() {for (;_<=(1
<<1<<1)+1;){__ =(++_+1<<1<<1)-
(1<<(1<<1))+(___ =1);for (;___<=(1
<<1<<1)+((_&1)<<1) ;){__=(_____=_==((
1<<1<<1)+1)?(_=(1<<1<<1)+1):0)?_____:__
;for (;____<=(1<<(10>>1))+((1<<(10>>1)>>1));____++) OOO::OO((((1<<(10>>1))+((1
<<(10>>1)>>1))>>1)-____)>__||(____
-((1<<(10>>1))+((1<<(10>>1)>>1
))>>1))>__?0x20:0x2A);OOO::OO(
0x0A);__+=(___%(1<<1)==0)
+(___++%(1<<1+1)==0)
+(1<<1)+(____=0)
;}}_O_(
);}
最后祝大家圣诞节快乐!祝可爱的小猫咪身体健康,平安顺遂
你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧
名称栏目:C++混乱编程?“可可爱爱”的圣诞树代码!-创新互联
网页URL:https://www.cdcxhl.com/article6/cdodig.html
成都网站建设公司_创新互联,为您提供云服务器、网站设计、移动网站建设、关键词优化、网站导航、自适应网站
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联