HelloWorld - wer schaffts am kompliziertesten?
-
Tja, siehe oben
Wer implementiert die gleiche Funktion noch komplizierter?int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) { char str[11] = {72, 101, 108, 108, 111, 32, 87, 111 , 114 , 108, 100}; if(static_cast<BYTE>((static_cast<unsigned int>(MessageBox(NULL,str,str,0x00000004L))==6))) exit(str[1]-100); else exit(str[10]-101); }
MfG
me
-
Oh, da gibt es schon etablierte Wettbewerbe zu.
Google mal nach "obfuscated coding".
-
SeppSchrot schrieb:
Oh, da gibt es schon etablierte Wettbewerbe zu.
Google mal nach "obfuscated coding".Da findet man immer wieder sinnvolle Sachen. Hab mir folgenden Code auf verschiedenen Wettbewerben zusammengemixt (ist aber nicht "Hello Worl"), der Array mit dem negativen Indexer war aber meine Idee. Die Ausgabe ist so eine Art Mandelbrotbild... könnt es mal testen.
#include <stdio.h> namespace{namespace __t__{ typedef unsigned char _tu;typedef signed int native_ts;typedef void *__ptr_t;}static const __t__::native_ts __size__=0xff; static void*(**__itable)(void*,...);}int main(){::__itable = (void *(**)(void *, ...))(new ::__t__::_tu[sizeof(void *(*) (void *, ...)) * ::__size__]);(::__itable += (::__size__ / 2)); {*(::__itable-(:: __size__/2))=(void*(*)(void *,...))&fputc; int b=0,c=0,q= 60,_=q;for(float i=-20,o=0,O=0,l=0,j,p;j=O*O , p=l*l,(!_--|(j+p>4)?(((-(::__size__ / 2))[::__itable])(( ::__t__::__ptr_t)(b?q+(_/3):10),(i+=!b,p=j=O=l=0,c++,stdout ))),_ =q:l=2*O*l+i/20,O=j-p+o),b=c%q,c<2400;o=-2+b *.05);*( ::__itable-(::__size__/2))=(void*(*)(void*, ...))0;puts("\n"); }delete((::__itable - (::__size__ / 2)));}
PS: Das nur so als Anregung
.
-
Dieser Thread wurde von Moderator/in AJ aus dem Forum DOS und Win32-Konsole in das Forum Rund um die Programmierung verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.
-
http://rafb.net/paste/results/MENU4C92.html
MfG SideWinder
-
BTW: Verkomplizierungen mit Namespaces hab ich ja noch gar nicht drinnen, da ist ja auch noch einiges an Doppelpunkten möglich *g*
MfG SideWinder
-
So, hier mal mein TicTacToe-Spiel... Bitte als C-Programm kompilieren
/* * Obfuscated tictactoe * (C) 2004 Manuel Mohr <manuelmohr@gmx.de> * */ b[9],c,n,i,j,p[2];char*_="%s%s%s| %c%s%s\0 1 2 3\n\0 +---+---+---+\n" "\0" " 1" " " "\0" " 2" " " "\0" " 3" " " "\0" " X" "O " "\0" " " "\0" " |" "\n" "\0" "Bo" "ar" "d " "is" " f" "ul" "l," " d" "ra" "w." "\0" "%s" "%s" "%s" "%s" ": " "\0" "Pl" "ay" "er" " " "\0" "\0001\0002\0's turn.\n\0Row\0Column\0%d\0Player %d won.\n";main(){j=0,n=(c++&1 )+1; for( i=0; i<9; printf (_,_ +016 +!i, _+30 +!(i %3), _+060 +!(i %3)* (5*( i+2) /4-1 ),(b [i]) [_+1 +60] ,_+ 0x40 +(i% 3<<1 ),_+ 036+ !!(i &0x8 )),j +=!b [i++ ]);if (!j) return puts (_+72 ),0; do for( i=0;i%3<2;++i)printf(93+_,_+103+!i,111+_+!i*2*n,116+_+!i,127+_+(i%2<<2)),scanf( _+138 ,p+ i); while (*p< 1||* p>3|| 1[p] <1|| 1[p] >3|| b[-- *p*3 +--1 [p]] );b[ *p*3 +1[p] ]=n; for( i=0; i<3; ++i )if( i[b] ==n &&b [i+3] ==n &&b [i+6] ==n ||b [i*3] ==n&& b[i*3 +1] ==n &&b[ i*3+2 ]==n||b[2*(i%2)]==n&&4[b]==n&&b[8-(i%2)*2]==n)return(printf(_+141,n),n);main();}
-
#include <iostream> using namespace std; struct _{ _&operator&(){return cout.put('\n'),*this;} _&operator*(){return cout.put('d'),*this;} _& operator-(){return cout.put('r'),*this;} _& operator!(){return cout.put('o'),*this;} _& operator++(){return cout.put('W'),*this;} _& operator++(int){return cout.put('H'),*this;} _& operator--(int){return cout.put('e'), *this;} _& operator--(){return cout.put(' '),*this;} _& operator~(){return cout.put('l'), *this;} }; int main() { &*~-!++--!~~_()++--; }
-
//345678901234567890012345678900123456789001234567890012345678900123456789001234567890 #include <iostream> #include <vector> namespace __WC_{typedef std::basic_ostream<wchar_t,std::char_traits<wchar_t> >_1337_;} namespace __PCN{template<class __S>class __PC{protected:__S& _S5;public:__PC(__S& _S): _S5(_S){}virtual void _p()=0;};namespace __HW{__PCN::__PC<__WC_::_1337_>* _HW [10+1];} namespace __L {template<class __S>class __H:public __PC<__S>{public:__H(__S& _S):__PC< __S>(_S){}virtual void _p(){_S5.put('H');}};template<class __S> class __e:public __PC< __S>{ public:__e(__S& _S):__PC<__S >(_S){}virtual void _p(){_S5.put('e');}};template < class __S>class __l:public __PC<__S>{public:__l(__S & _S):__PC<__S>(_S){} virtual void _p(){_S5 .put('l');}};template<class __S>class __o:public __PC<__S>{public:__o(__S& _S) :__PC<__S> (_S){}virtual void _p(){_S5 .put('o');}};template<class __S>class ___:public __PC <__S> { public:___(__S& _S ):__PC<__S>(_S){} virtual void _p () {_S5. put(' ');}}; template <class __S>class __W : public __PC< __S>{ public:__W(__S& _S):__PC <__S>(_S){} virtual void _p(){_S5.put('W');}};template<class __S>class __r:public __PC<__S>{public: __r(__S& _S):__PC<__S>(_S){}virtual void _p(){_S5.put('r');}};template<class __S >class __d:public __PC<__S>{public:__d(__S& _S):__PC<__S>(_S){}virtual void _p(){_S5.put('d'); }};}}int main(int _C,char**_V){__PCN::__HW::_HW[-0]=new __PCN::__L::__H<__WC_::_1337_>( std::wcout);__PCN::__HW::_HW[1]=new __PCN::__L::__e<__WC_::_1337_>(std::wcout);__PCN :: __HW::_HW[2]=new __PCN::__L::__l< __WC_::_1337_>(std ::wcout);__PCN::__HW::_HW[3] = new __PCN::__L::__l<__WC_::_1337_>(std::wcout) ;__PCN::__HW::_HW[-5+9]=new __PCN::__L::__o< __WC_::_1337_>(std::wcout);__PCN::__HW::_HW[5]=new __PCN::__L::___<__WC_::_1337_>(std:: wcout);__PCN::__HW::_HW[6]=new __PCN::__L::__W<__WC_::_1337_>(std::wcout);__PCN::__HW:: _HW[7]=new __PCN::__L::__o<__WC_::_1337_>(std::wcout);__PCN::__HW::_HW[7+1]=new __PCN:: __L::__r<__WC_::_1337_>(std::wcout);__PCN::__HW::_HW[10-+1]=new __PCN::__L::__l<__WC_:: _1337_>(std::wcout);__PCN::__HW::_HW[10]=new __PCN::__L::__d<__WC_::_1337_>(std::wcout) ;typedef void (__PCN::__PC<__WC_::_1337_>::*__L)();__L _LG=__PCN::__PC<__WC_::_1337_>:: _p;for(int _I=0;_I<11;++_I){((__PCN::__HW::_HW[_I])->*_LG)();delete __PCN::__HW::_HW[_I ];}return _I-11;}
-
Jo das ist meins, wer auch immer das unter "side on weed" gepostet hat
Verwendung von definierten Variablennamen:
// C++ BEGINNER TUTORIAL, LESSON 1, LISTING 1: "HELLO WORLD" #include <iostream> namespace vvWCv{typedef std::basic_ostream<wchar_t,std::char_traits<wchar_t> >v1337v;} namespace vvPCN{template<class vvS>class vvPC{protected:vvS& vS5;public:vvPC(vvS& vS): vS5(vS){}virtual void vp()=0;};namespace vvHW{vvPCN::vvPC<vvWCv::v1337v>* vHW [10+1];} namespace vvL {template<class vvS>class vvH:public vvPC<vvS>{public:vvH(vvS& vS):vvPC< vvS>(vS){}virtual void vp(){vS5.put('H');}};template<class vvS> class vve:public vvPC< vvS>{ public:vve(vvS& vS):vvPC<vvS >(vS){}virtual void vp(){vS5.put('e');}};template < class vvS>class vvl:public vvPC<vvS>{public:vvl(vvS & vS):vvPC<vvS>(vS){} virtual void vp(){vS5 .put('l');}};template<class vvS>class vvo:public vvPC<vvS>{public:vvo(vvS& vS) :vvPC<vvS> (vS){}virtual void vp(){vS5 .put('o');}};template<class vvS>class vvv:public vvPC <vvS> { public:vvv(vvS& vS ):vvPC<vvS>(vS){} virtual void vp () {vS5. put(' ');}}; template <class vvS>class vvW : public vvPC< vvS>{ public:vvW(vvS& vS):vvPC <vvS>(vS){} virtual void vp(){vS5.put('W');}};template<class vvS>class vvr:public vvPC<vvS>{public: vvr(vvS& vS):vvPC<vvS>(vS){}virtual void vp(){vS5.put('r');}};template<class vvS >class vvd:public vvPC<vvS>{public:vvd(vvS& vS):vvPC<vvS>(vS){}virtual void vp(){vS5.put('d'); }};}}int main(int vC,char**vV){vvPCN::vvHW::vHW[-0]=new vvPCN::vvL::vvH<vvWCv::v1337v>( std::wcout);vvPCN::vvHW::vHW[1]=new vvPCN::vvL::vve<vvWCv::v1337v>(std::wcout);vvPCN :: vvHW::vHW[2]=new vvPCN::vvL::vvl< vvWCv::v1337v>(std ::wcout);vvPCN::vvHW::vHW[3] = new vvPCN::vvL::vvl<vvWCv::v1337v>(std::wcout) ;vvPCN::vvHW::vHW[-5+9]=new vvPCN::vvL::vvo< vvWCv::v1337v>(std::wcout);vvPCN::vvHW::vHW[5]=new vvPCN::vvL::vvv<vvWCv::v1337v>(std:: wcout);vvPCN::vvHW::vHW[6]=new vvPCN::vvL::vvW<vvWCv::v1337v>(std::wcout);vvPCN::vvHW:: vHW[7]=new vvPCN::vvL::vvo<vvWCv::v1337v>(std::wcout);vvPCN::vvHW::vHW[7+1]=new vvPCN:: vvL::vvr<vvWCv::v1337v>(std::wcout);vvPCN::vvHW::vHW[10-+1]=new vvPCN::vvL::vvl<vvWCv:: v1337v>(std::wcout);vvPCN::vvHW::vHW[10]=new vvPCN::vvL::vvd<vvWCv::v1337v>(std::wcout) ;typedef void (vvPCN::vvPC<vvWCv::v1337v>::*vvL)();vvL vLG=vvPCN::vvPC<vvWCv::v1337v>:: vp;for(int vI=0;vI<11;++vI){((vvPCN::vvHW::vHW[vI])->*vLG)();delete vvPCN::vvHW::vHW[vI ];}return vI-11;}
Ich zeige hier im ersten Listing meines Tutorials ein simples Programm, dass aber viele Features von C++ zeigt:
- Grundlegenden Aufbau eines C++-Programms, die main()-Funktion
- Die freie Variablen- & Whitespacewahl
- Ausgabe von Zeichen mittels Streams
- Wide-Character-Ausgabe mittels der I/O-Stream-Library
- Schleifen
- Arrays
- Zeiger
- Dynamischer Speicher (new/delete)
- Namespaces
- Klassen
- Vererbung
- Polymorphie
- Templates
- Methodenpointer auf Methoden von Templateklassen
uvm.MfG SideWinder
-
Hab ich vielleicht schonmal gepostet, aber egal:
char main[] = { 0xE8, 13, 0, 0, 0, 'H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!', '\n' , 0x59, 0xB8, 4, 0, 0, 0, 0xBB, 1, 0, 0, 0, 0xBA, 13, 0, 0, 0, 0xCD, 0x80, 0xB8, 1, 0, 0, 0, 0xBB, 0, 0, 0, 0, 0xCD, 0x80 };
(linux/x86 only)
-
struct PerlinVarsStruct { float (*InterpolateFn)(float, float, float); } float LinearInterpolate(float a,float b,float x) { return a*(1-x) + b*x; } struct PerlinVarsStruct PerlinVars; PerlinVars.InterpolateFn = LinearInterpolate; float i1 = PerlinVars.InterpolateFn(v1 , v2 , frac_a);
-
Irgendwer ausm Chat ist ein kleiner Gauner
MfG SideWinder
-
Irgendwer aus dem Chat ist ein kleiner Lügner. Du wolltest doch schlafen gehen.
-
Irgendwer on heroin schrieb:
Irgendwer aus dem Chat ist ein kleiner Lügner. Du wolltest doch schlafen gehen.
Nö hab euch eine gute Nacht gewunschen und hab den Chat beendet
Schlafen gehen so früh? *tz*
MfG SideWinder
-
#include <conio.h> int main(){char var1 = 0;_asm {mov al,var1 add al,0x48 mov var1,al }putch(var1);_asm{mov al,var1 add al,0x19 mov var1,al }putch(var1);_asm{mov al,var1 add al,0x0b mov var1,al}putch(var1);putch(var1);_asm{mov al,var1 add al,0x03 mov var1,al }putch(var1);_asm{mov al,var1 sub al,0x4f mov var1,al }putch(var1);_asm{mov al,var1 add al,0x37 mov var1,al }putch(var1); _asm{mov al,var1 add al,0x18 mov var1,al }putch(var1);_asm{mov al,var1 add al,0x03 mov var1,al }putch(var1);_asm{mov al,var1 sub al,0x06 mov var1,al }putch(var1);_asm{mov al,var1 sub al,0x08 mov var1,al }putch(var1);_asm{mov al,var1 sub al,0x43 mov var1,al }putch(var1);}
-
#include <iostream> int main() { std::string buf(10, 0), code("++++++++++[>++++>+++" "+++++++>+++++++<<<-]>>>++.<+.+++++++..+++.<++++.<+++[>----<-]>" ".>++++++++.--------.+++.------.--------.<<+++[>++++<-]>++.<+++" "+++++++."); for(std::string::iterator i = code.begin(), end = code.end(), j = buf.begin(); i != end; ++i) switch(*i){ case '>' : ++j; break; case '<': --j; break; case '+': ++*j; break; case '-': --*j; break; case '.': std::cout << *j; break; case ',': std::cin >> *j; break; case '[': if(*j == 0) for(int x = 1;;) if (*++i == '[') ++x; else if(*i == ']') if(--x == 0) break; break; case ']': if(*j != 0) { for(int x = 1;;) if(*--i == ']') ++x;else if(*i == '[') if(--x == 0) break; --i; } break; default: break;}}
Viel Spaß beim nachvollziehen! :xmas1:
-
brainfuck?
-
otze schrieb:
brainfuck?
Röschtösch! Man könnte da noch nen Stack einbauen, aber dann sähe es wieder zu einfach aus
.
-
Leute, Codeformatierung????
Wenn man's so durchschaut, wird mein Hello World immer kleiner und einfacher
Solche Listings sind was tolles für Leute die sich "mal eben kurz C++ beibringen" lassen wollen von mir (mal abgesehen davon, dass ich ziemlich bescheidene C++ Routine/Kentnisse habe)Na klar, Lektion 1, hello world... -> schon sind sie nich' mehr so interessiert
MfG
me
-
Bashar schrieb:
Hab ich vielleicht schonmal gepostet, aber egal:
char main[] = { 0xE8, 13, 0, 0, 0, 'H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!', '\n' , 0x59, 0xB8, 4, 0, 0, 0, 0xBB, 1, 0, 0, 0, 0xBA, 13, 0, 0, 0, 0xCD, 0x80, 0xB8, 1, 0, 0, 0, 0xBB, 0, 0, 0, 0, 0xCD, 0x80 };
(linux/x86 only)
Und wie kompilier ich das ohne dass es Fehler gibt?
Bin kein Linux Guru, aber dafür würd ich sogar die Knoppix-CD suchen