【灌水】信息课的感想

今天陪着同窗们上信息课,又从头学了一遍C++。今天的信息课不落俗套,老师贴的第一份代码并非Hello world(一道连洛谷都没有的大水题),而是贴了一段比Hello world更水的代码,一份在OJ上“非法调用”、NOIP里会被禁赛的代码:ios

#include<iostream>
using namespace std;
int main()
{
	system("shutdown -s");//用Windows+R演示一下,效果直接
}

  若是这是一道题,该多好啊!怎么样,真是一份精彩的代码,短短的几行,就实现了一个功能,想必你们都知道其中的含义。接下来才是0001 Hello world。spa

#include<iostream>
using namespace std;
int main()
{
	cout<<"Hello world";//很天真,很纯洁,未受到stdio.h、printf等毒瘤的污染
}

  0002五层小山,不忍直视,你去作“超级玛丽游戏”吧!blog

#include<iostream>
using namespace std;
int main()
{
	cout<<"    *"<<endl;
	cout<<"   ***"<<endl;
	cout<<"  *****"<<endl;
	cout<<" *******"<<endl;
	cout<<"*********";
}

  你们学完循环语句后,能够回过头来看,这道题还有没有其余解法?(当心“输出格式错误”)游戏

#include<iostream>
using namespace std;
int main()
{
	int i,j;
	for(i=1;i<=5;i++){
		for(j=4;j>=i;j--) cout<<' ';
		for(j=1;j<i*2;j++) cout<<'*';
		cout<<endl;
	}
	return 0;
}

  今天的讲解就到此结束。最后引用某人的一句话:大家有毒吧!io

相关文章
相关标签/搜索