Basic C++ “Virus”

March 25, 2017 | Views: 23199

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATIONAlready a Member Login Here

Hi everyone,

This is my first article on this site, I hope you will enjoy it! 🙂

What I’m going to show you today is a simple C++ virus, or scam (whatever you want to call it), that is very annoying once opened and requires a system reboot in order to stop it.

What it actually does is very simple to understand:

  • It basically goes in an infinite loop, running only one command that makes the computer to continuously produce a very annoying sound, and because of that infinite loop, the program cannot be closed.

Without further introduction, here is the code:

#include <iostream>

using namespace std;

int main() {

for(long long i=1;i<=100;i--)

cout<<(char)7;

}

// very important, when saving this program, save it with this extension: ".cpp" and after getting its executable, you can troll whoever you want XD

//notice that we started a loop with i=1 and set it to stop when i reaches 100, the only problem being that "i--", that creates the infinite loop

 

Thank you for reading my article. I hope you enjoyed it!

Best regards!

Share with Friends
FacebookTwitterLinkedInEmail
Use Cybytes and
Tip the Author!
Join
Share with Friends
FacebookTwitterLinkedInEmail
Ready to share your knowledge and expertise?
21 Comments
  1. can i know, how it works???

  2. Bad programming 😀

Page 3 of 3«123
Comment on This

You must be logged in to post a comment.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Support Cybrary

Donate Here to Get This Month's Donor Badge

 

Cybrary|0P3N

Is Linux Worth Learning in 2020?
Views: 332 / December 14, 2019
How do I Get MTA Certified?
Views: 924 / December 12, 2019
How much does your PAM software really cost?
Views: 1377 / December 10, 2019
How Do I Get into Android Development?
Views: 1755 / December 8, 2019

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel