码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2016-04-14 22:20:57      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:

病毒程序示范

 1 /*
 2 龌龊的程序!
 3 */
 4 # include <stdio.h>
 5 # include <windows.h>
 6 # include <malloc.h>
 7 #include<cstdlib>
 8 
 9 int main(void)
10 {
11     int c;
12     int i;
13     int j;
14 
15     Nihao:
16     printf("1:死机\n");
17     printf("2:机房爆炸\n");
18     printf("请选择:\n");
19 
20     scanf("%d,&c");
21 
22     if  (c ==1)
23     {
24         system("shutdown -s -t 60");
25     }
26     else if (2 == c)
27     {
28         printf("你太坏了 我要惩罚你!\n");
29         for (j=0;j<10;++j){
30             system("start");
31         }
32     }
33     else
34     {
35         printf("你敲错了,请重新输入!\n");
36         goto Nihao;
37     }
38     return 0;
39 }

 

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

1 #include < stdio.h > #include < malloc.h >
2 
3     int main(void) {
4         while (1) {
5             int * p = (int * ) malloc(1000);
6         }
7         return 0;
8     }

 

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

标签:

原文地址:http://www.cnblogs.com/shamgod/p/5392888.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!