您的位置:首页 > 编程语言 > C语言/C++

C语言-郝斌笔记-002病毒程序示范

2016-04-14 21:40 281 查看
病毒程序示范

/*
龌龊的程序!
*/
# include <stdio.h>
# include <windows.h>
# include <malloc.h>
#include<cstdlib>

int main(void)
{
int c;
int i;
int j;

Nihao:
printf("1:死机\n");
printf("2:机房爆炸\n");
printf("请选择:\n");

scanf("%d,&c");

if  (c ==1)
{
system("shutdown -s -t 60");
}
else if (2 == c)
{
printf("你太坏了 我要惩罚你!\n");
for (j=0;j<10;++j){
system("start");
}
}
else
{
printf("你敲错了,请重新输入!\n");
goto Nihao;
}
return 0;
}


内存泄露(占满内存)程序导致死机实例

#include < stdio.h > #include < malloc.h >

int main(void) {
while (1) {
int * p = (int * ) malloc(1000);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: