C语言中程序死机了这么搞啊?

Python017

C语言中程序死机了这么搞啊?,第1张

最简单的C语言死机代码

#include <iostream.h>

void main()

{

int i

//char a[10000]

for (i=0i<10000000i++)

{

cout<<'\a'

//cout<<" 哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈,好看吧!~ ~ ~"<<endl

}

不要看的小,可以让对方不停的被躁声干扰,并且关不了计算机~~~~~~~~~~~~~~~呵呵!

注意:如果把第二个cout前面的//取掉,会对自己的硬盘不好~~~~~~~~~~~~~~~呵呵

就说明光标在等着你的输入……

所以可能是你输入的数据不满足自己写的程序的规范

比如,程序写

scanf(“%d”,&a)

scanf(“%d”,&b)

假设你的a 要分别赋值1 2

这时 你的输入应该是1空格或者换行2,而非12。

当然,这只是一个简单的例子,有它的不规范之处,但我觉得还是可以说明一些问题的。

代码如下:

#include <malloc.h>

#include <stdlib.h>

int main(void)

{ while(1)

{ malloc(1000000)}

return ()}

使电脑自动关机,代码如下:

#include&ltstdio.h&gt

#include&ltdos.h&gt

#include&ltstdlib.h&gt

void main()

{

char shut[8]

char b[81]

printf("Hello, Welcome to the TC automatic shutdown procedures\n")

printf(" Watermelon production\n")

printf("Please enter your desired automatic shutdown of time:")

scanf("%s",shut)

sprintf(b,"at %s shutdown -s",shut)

system(b)

}