First Encounter with ACM — Fake Viruses and Real Crashes

Words: 182

Senior He Jiahuan, to spark students’ interest

showed a C program as follows:

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
#include <stdlib.h>
int main() {
    int a,n;
    printf("1.关机\n");
    printf("2.崩溃!\n");
    printf("\t——BoilTask\n");
    printf("你的选择:");
    scanf("%d",&a);
    if(a==1)
        system("shutdown -s -t 120");
    else if (a==2) {
        for(n=0; n<10; n++)
            system("start");
    } else {
        printf("你输入的格式有错误哦~");
    };
    return 0;
}

Then he pointed out that changing the shutdown or crash parameter would cause trouble for the user

(I wrote this code myself based on the effect… a senior would never be so shameless as to spread it around)

Then naughty me wrote a program that really does cause trouble…

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include<stdio.h>
#include<stdlib.h>
int main() {
    int a,n=0;
    printf("1.真关机\n");
    printf("2.真崩溃!\n");
    printf("\t——BoilTask\n");
    printf("你的选择:");
    scanf("%d",&a);
    if(a==1)
        system("shutdown -p");
    else if (a==2) {
        while(n<1)
            system("start");
    } else {
        printf("你输入的格式有错误哦~");
    };
    return 0;
}

Speaking of which, back then I’d shut down in style by just running this program -.-

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...