Coollest 6 Lines C++ Program





Introduction: Coollest 6 Lines C++ Program

This is a funny program I made while learning C++. Idea by My!! I hope no one has done this before =D... Maybee i just reinvented the bike, but its fun!! Code should work on windows and linux. but you have to compile it yourself and little diferent than how I done. THIS INSTRUCTABLE IS MADE BASICLY FOR MAC USERS WITH Xcode!!!

What does it do?
Simple. LAG! On MAC!!!

Features ( =D):

  # It gives continiuos alert sounds (in my case submarine beeps) forever until You terminate it.
  # Prints Your message(In My case danger!! some $%# and LAG) forever until You terminate it.
  # It uses lot of processing power till You terminate it.
  # It is not very easy to terminate it.
  # If You have selected terminal and try to type something it gets even more annoying( some kind of Laggy sounds)!!

Step 1: You Will Need.

Stuff you will need is:

ANY PC or MAC (newer then one from 1983)
C++ compiler or IDE
Plain text editor or IDE
Some command line knowlage


Good music while Programming.

Step 2: The Code

Paste this code instead of the one you heve in main.cpp (if there is some code)

The source code:

#include < iostream>
int main () {
    while (1){
        std::cout<< "DAnGer!&$!@#^^%$#    LAG )( *&^%  ^%@%# ?>|  \a\a\a\a\a\a";

Step 3: How It Works AND Customize It!!

#include < iostream>

\\ Iostream is basic c++ library and its needed for our program. We include it using #include.

int main ()

\\ int main is the main function which is always executed.


\\start of main () funcion tree.

    while (1)

\\ Infinite cycle veriable. (1) makes it infinite.

\\ { is a start of our infinite cycle tree.
   std::cout<< "DAnGer!&$!@#^^%$#    LAG )( *&^%  ^%@%# ?>|  \a\a\a\a\a\a";

\* std:: means we use stuff from iostream library. cout is thing that prints stuff in screen. << gives cout what to print. "   " inside commas is stuff that we need to print on scree. \a will not be printed because its command that gives alert. this cout repeats forever because its in infinite cycle.
if Your want custom text  You suhould replace "DAnGer!&$!@#^^%$#    LAG )( *&^%  ^%@%# ?>|  \a\a\a\a\a\a" with "Your text here \a\a\a\a\a" Your text mustn't contain commas (")   *\


\\ these } closes our cycle tree and function main () tree.

Step 4: Compile.

Compile your way or simply press cmd+b.
If You are on Xcode I don't recommend to "press build and run" key.

Step 5: Run and Terminate.

Result will be in Xcode and in DirectoryOfYourProject/build/debug/

Now test it. if stuff goes bad Terminate it using cmd+alt+esc key. it will still be running, but You wont be able to see! go to applications/utilitys/Activity Monitor and terminate it from there.

Step 6: Put It in Use! (prank)

Now lets make some fun. Customize this application and send it to your friends. Good for april foolz.

I will pretend its a tic tac toe game.

1st find icon
Use icon composer to convert it into .icns
Then select executable in finder press cmd+i
Drag icns file like you see in picture
Rename Your lag so it will look like game
Send it to your good friend...
    ..... orrrrr enemy! =D


You can download allready finished application.

P.S. If you want even more lag you can add some pointless mathematics to optimise your application for even more CPU use....



    • Oil Contest

      Oil Contest
    • Water Contest

      Water Contest
    • Clocks Contest

      Clocks Contest

    6 Discussions

    It's not more or less the same, it's exactly the same.  The compiler should generate identical machine code in both cases.

    Sorry, I was trying to be funny.  Used to be that emotionally immature would spend hundred of hours flaming each other over issues like this - whether the curly-braces should be on the end of a line, or on the beginning of the next, how to indent, how to format comments, etc,

    2 replies

    Im not sure again, but I think compiler reads stuff the same if you do like this

    cout << "1st example" ;
    cout << "1st example" ;

    cout << "2nd example" ; cout << "2nd example" ;

    so putting braces in next line doesnt change anything... right?
    please tell me the word "intdent" in other words. I'm not wery good in English....

    The braces war was between the traditionalists, who formatted their code thus:
    if (x) {
    } else {

    and the more modern, who'd line up their braces vertically:
    if (x)

    And then there were the Gnubots, who preferred:
    if (x)
    None of it mattered in the slightest to the compiler, of course, the arguments were over which was most readable.

    I thought everyone knew that the proper C++ idiom for infinite loops was:

    for (;;)
    2 replies

    I'm not sure, but I think its more or less the same...... Did You tried to run this program? It's really fun. If You want You can put for (;;) instead while(1). Program should work the same.