hello world



  • Dravere schrieb:

    unskilled schrieb:

    std::cout.write("Hello world!", 12);
    ist ja mal mehr, als hässlich...

    Dafür effizient! Kein strlen oder ähnliches nötig. PO FTW! 😃 😉 :p

    Grüssli

    naja - bei ausgaben ist mir die effizenz ziemlich egal 😛
    außerdem kannst du mir nicht erzählen, dass dein compiler (ich meine, mich erinnern zu können, dass das auch der msvc ist ^^) zu blöd ist, die länge zur compilezeit festzustellen 😛

    bb


  • Administrator

    unskilled schrieb:

    naja - bei ausgaben ist mir die effizenz ziemlich egal 😛
    außerdem kannst du mir nicht erzählen, dass dein compiler (ich meine, mich erinnern zu können, dass das auch der msvc ist ^^) zu blöd ist, die länge zur compilezeit festzustellen 😛

    Es macht im Endeffekt wahrscheinlich einen Unterschied von 0%. Deshalb auch die Smilies und deshalb ist es ein super Beispiel für PO 😉
    Aber ich habe es mal von jemanden so vor die Schnauze geliefert bekommen, weil es effizienter sei. Seither ist es mein Favorit *g*

    Grüssli



  • Dravere schrieb:

    unskilled schrieb:

    naja - bei ausgaben ist mir die effizenz ziemlich egal 😛
    außerdem kannst du mir nicht erzählen, dass dein compiler (ich meine, mich erinnern zu können, dass das auch der msvc ist ^^) zu blöd ist, die länge zur compilezeit festzustellen 😛

    Es macht im Endeffekt wahrscheinlich einen Unterschied von 0%. Deshalb auch die Smilies und deshalb ist es ein super Beispiel für PO 😉
    Aber ich habe es mal von jemanden so vor die Schnauze geliefert bekommen, weil es effizienter sei. Seither ist es mein Favorit *g*

    Grüssli

    ok 😃
    ich hatte ja die vermutung, dass der operator<< (ostream&, const std::string&) intern write aufruft - aber das ist (in msvc) offenbar nicht der fall ^^ bin aber gerade zu müde, um weiter zu suchen und zu vergleichen - früh aufstehen is doof ><

    bb



  • Dravere schrieb:

    Ich sehe schon Nexus angerannt kommen mit:

    #include <iostream>
    
    int main()
    {
      std::cout << "Hello world!" << std::endl;
    }
    

    Hey! Das ist wohl auch das Naheliegendste. 🙂

    (David_pb kam übrigens schon früher angerannt...)



  • Wenn schon müssen wir die ganze Sache bunt machen!

    #include <iostream>
    #include <windows.h>
    
    enum Colors { blue = 1, green, cyan, red, purple, yellow, grey, dgrey, hblue, hgreen, hred, hpurple, hyellow, hwhite, dwhite};
    
    void coutc(int color, std::string output)
    {
       HANDLE handle= GetStdHandle(STD_OUTPUT_HANDLE);
       SetConsoleTextAttribute( handle, color);
       std::cout << output;
       SetConsoleTextAttribute( handle, color);
    }
    
    int main()
    {
        coutc(green, "Hello ");
        coutc(red, "World");
        coutc(blue, "!");
    }
    

  • Administrator

    @Nexus,
    Wups, den habe ich komplett übersehen. 🙂

    @FreakY<3Cpp,
    Das würde aber eher in WinAPI reingehören und nicht in C++ 😉

    Grüssli



  • Is aber C++ 😃👍


  • Administrator

    FreakY<3Cpp schrieb:

    Is aber C++ 😃👍

    Aber nicht reines C++ und wir sind hier ja ISO Standard C++ Forum 😉

    Grüssli



  • Rein... ich hätte auch gerne reinen Sauerstoff, aber das Leben ist kein Ponyhof 🕶


  • Administrator

    FreakY<3Cpp schrieb:

    Rein... ich hätte auch gerne reinen Sauerstoff, aber das Leben ist kein Ponyhof 🕶

    Daran zweifle ich etwas:
    http://de.wikipedia.org/wiki/Sauerstoffvergiftung

    Und du kannst nichts dagegen machen, dass wir hier im ISO C++ Forum sind 😉
    Aber die Sache ist nun schon etwas pingelig 😃

    Grüssli



  • #include <stdio.h>
    
    void oof(char const* p)
    {
    	if (*p)
    	{
    		oof(p + 1);
    		_fputchar(*p);
    	}
    }
    
    int main()
    {
    	oof("\n!dlrow ,olleH");
    }
    


  • Nice, hustbaer, sehr nice! 😃



  • also mal ehrlich...
    nimm doch wenigstens <cstdio> statt dem C-Header



  • Ihr immer mit euren RIEEESSENN Programm die arme Festplatte...

    Belegt nur 1 Kb 😃

    .MODEL Small   
    .STACK 100h   
    .DATA          
    
    hello DB "Hello World ! $"
    
    .code
    start:
    
    	mov ax,@data
    	mov ds,ax
    	mov dx,offset hello
    
    	mov ah,09h
    	int 21h
    
    	mov ah,4ch
    	int 21h
    
     END  Start
    


  • Viel zu übersichtlich...

    obfuscation.h

    #define _ ;
    #define __ std::cout
    #define ___ <<
    #define ____ {
    #define _____ }
    #define ______ int
    #define _______ main
    #define ________ (
    #define _________ )
    #define __________ "Hello world\n"
    

    ___.cpp

    #include "obfuscation.h"
    
    ______ _______ ________ _________
    ____ __ ___ __________ _ _____
    


  • Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
    Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
    Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook.
    Ook! Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
    Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook?
    Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
    Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook! Ook. Ook. Ook. Ook. Ook.
    Ook. Ook. Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook.
    Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
    Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook.
    Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
    Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
    Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
    Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
    Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
    Ook! Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
    Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook!
    Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook! Ook.
    

    Nicht wirklkich c++, aber cool 😃
    http://de.wikipedia.org/wiki/Ook!


Anmelden zum Antworten