Registration has been disabled and the moderation extension has been turned off.
Contact an admin on Discord or EDF if you want an account. Also fuck bots.

C++: Difference between revisions

From Encyclopedia Dramatica
Jump to navigation Jump to search
imported>Mu.ollin
imported>Psychob
→‎Example plz: not using initializations list.... ISHYGDDT
Line 17: Line 17:
   {
   {
   public:
   public:
       You()
       You() : brain(true), power(1), success(0)
      {
       { }
          brain = true;
          power = 1;
          success = 0;
       }
    
    
       ~You()
       ~You()

Revision as of 12:18, 26 September 2011

C++ is part of a series on Programming.

[2 L337 4 MEEnter the Matrix]

ADAAssemblyCC++COBOLDebugDOSErlangErrorFdiskFortranIntegerJavaLOLCodeMachine CodeMatlabMIRC ScriptMUMPSOpen SourcePerlPHPProgramming languagePythonQBASICRuby on RailsScratchSSHVisual Basic

Hacks

Firefox XPS IRC AttackSafari XPS Attack Sandworm

Programmers

Bill GatesLinus TorvaldsWeevGoatse SecurityTerry DavisTheo de Raadt

Other Topics

Operating systemWarezNotepadIs not a bug, it's a featureDatabase Error

C++ is C's evil twin brother. Imagine there is that guy who always ruins the fun. That is C++. It was developed by Bjarne Stroustrup at least 100 years ago and is used by fat nerds to perform black magic on their computers.

Basically, this is C with all the extended jizz jazz. But the only reason you want to use it is because of the classes. It also comes with typesafe code, multiple inheritance and backwards compatibility.

Example plz

So you want to learn it? Fine. You have to learn C first before you can make sense out of this.

 #include <stdio.h>
 
 void anHero()
 {
     exit(0);
 }
 
 class You
 {
 public:
     You() : brain(true), power(1), success(0)
     { }
 
     ~You()
     {
         anHero();
     }
 
     void doItFaggot()
     {
         success = 0;
     }
 
     bool brain;
     int power;
     float success;
 };
 
 int main(int argc, char **argv)
 {
     You *newfag = new You();
 
     while (true)
     {
         newfag->power++;
 
         if (newfag->power > 9000)
         {
             newfag->brain = false;
             newfag->success += 0.01;
 
             newfag->power = 0;
         }
 
         
         newfag->doItFaggot();
 
         if (newfag->success == 1)
         {
             printf("You Win The Game\n");
             break;
         }
     }
 
     printf("HAHAHA DISREGARD THAT, I SUCK COCKS\n");
     return 1;
 }

Explanation

Compile it with the compiler of your choice and execute it. You do not understand anything? Alright, let me translate into English.

  1. First, the program creates you.
  2. It enters an infinite loop.
  3. Your power is increased by 1.
  4. If your power is not over 9000, jump to 8.
  5. Your brain dies.
  6. Your success increases.
  7. Your power gets vaporized.
  8. Alright, now you DO IT FAGGOT.
  9. That means, you are a sick fuck and have no success.
  10. You get bored and leave doItFaggot.
  11. If you are successful, you Win The Game and jump to 13
  12. Go back to step 3.
  13. HAHAHA DISREGARD THAT, I SUCK COCKS

Makes sense, amirite? Okay Okay. Your exercise is to make sense out of that. Use Google and browse some C++ tutorials. Try to win the game. If you done that, you could even expand the code to greater detail, you sick fuck.

Visual C++

Just like many other failed attempts to revive all of the ghey languages of programming, Microhard had to remake the language to make it barely readable and completely long for infinite developmentz and for programming companies to go bankrupt. Nothing is more special then making the code propitiatory and non ascii so it never compiles. For example, a simple window that does absolutely nothing but waste space on your desktop is written like:

 #include <windows.h>
  
 const char g_szClassName[] = "lulz";
 
 LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
    switch(msg)
    {
       case WM_CLOSE:
          DestroyWindow(hwnd);
       break;
       case WM_DESTROY:
          PostQuitMessage(0);
       break;
       default:
          return DefWindowProc(hwnd, msg, wParam, lParam);
       break;
    }
    return 0;
 }
 
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
 {
    WNDCLASSEX wc;
    HWND hwnd;
    MSG Msg;
 
    wc.cbSize = sizeof(WNDCLASSEX);
    wc.style = 0;
    wc.lpfnWndProc = WndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = g_szClassName;
    wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
    
    hwnd = CreateWindowEx(
       WS_EX_CLIENTEDGE,
       g_szClassName,
       "Worthless Piece of shit.",
       WS_OVERLAPPEDWINDOW,
       CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
       NULL, NULL, hInstance, NULL);
 
    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);
    
    while(GetMessage(&Msg, NULL, 0, 0) > 0)
    {
       TranslateMessage(&Msg);
       DispatchMessage(&Msg);
    }
    return Msg.wParam;
 }

See Also

C++ is part of a series on

Softwarez

Visit the Softwarez Portal for complete coverage.