- Portals
- The Current Year
- ED in the News
- Admins
- Help ED Rebuild
- Archive
- ED Bookmarklet
- Donate Bitcoin
Contact an admin on Discord or EDF if you want an account. Also fuck bots.
C++
C++ is part of a series on Programming. [Enter the Matrix] | |
ADA • Assembly • C • C++ • COBOL • Debug • DOS • Erlang • Error • Fdisk • Fortran • Integer • Java • LOLCode • Machine Code • Matlab • MIRC Script • MUMPS • Open Source • Perl • PHP • Programming language • Python • QBASIC • Ruby on Rails • Scratch • SSH • Visual Basic
Firefox XPS IRC Attack • Safari XPS Attack • Sandworm
Bill Gates • Linus Torvalds • Weev • Goatse Security • Terry Davis • Theo de Raadt
Operating system • Warez • Notepad • Is not a bug, it's a feature • Database 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.
- First, the program creates you.
- It enters an infinite loop.
- Your power is increased by 1.
- If your power is not over 9000, jump to 8.
- Your brain dies.
- Your success increases.
- Your power gets vaporized.
- Alright, now you DO IT FAGGOT.
- That means, you are a sick fuck and have no success.
- You get bored and leave doItFaggot.
- If you are successful, you Win The Game and jump to 13
- Go back to step 3.
- 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 Visit the Softwarez Portal for complete coverage. |