Home 0P3N Blog Basic C++ "Virus"
Ready to Start Your Career?
Create Free Account
lc5273 s profile image
By: lc5273
March 25, 2017

Basic C++ "Virus"

By: lc5273
March 25, 2017
lc5273 s profile image
By: lc5273
March 25, 2017
c-codeHi 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!
Schedule Demo

Build your Cybersecurity or IT Career

Accelerate in your role, earn new certifications, and develop cutting-edge skills using the fastest growing catalog in the industry