ページ 1 / 1
[雑談]Hello,World
Posted: 2010年9月08日(水) 21:11
by みけCAT
みなさん、こんばんは。みけCATです。
高度なゲーム制作もいいですが、たまには基本に帰ってHello,Worldでもやりましょう。
というわけで、皆さんの好きな方法でHello,Worldと表示するプログラムを書いてみましょう。
言語はC言語かC++ですが、プラットフォームは問いません。
コンソールアプリケーションに限定もしません。
ちなみに自分は
#include <stdio.h>
int main(void) {
printf("Hello,World\n");
return 0;
}
です。
Re:[雑談]Hello,World
Posted: 2010年9月08日(水) 21:33
by バグ
んでは、捻らずにC++で…
#include <iostream>
int main(void)
{
std::cout << "Hello,World" << std::endl;
return 0;
}
おまけにC#でもw
class Program
{
static void Main(string[/url] args)
{
System.Console.WriteLine("Hello,World");
}
}
Re:[雑談]Hello,World
Posted: 2010年9月08日(水) 21:35
by Dixq (管理人)
> みけCATさん
こんばんは。面白そうですね。
いきなりhello worldじゃなくて申し訳ないのですが、私は「unix」と表示させる最も難解なコードとして有名な
void main(void) {printf(&unix["\021%six\012\0"], (unix)["have"]+"fun"-0x60);}
が結構好きです。
(Unix環境意外で動かす場合は最初に #define unix 1 が必要です)
パッと見、何が出力されるのか全然わかんないですよね^^;
トピの趣旨とずれてたらすみません。
このトピでは何かテクニカルな方法で hello world を表示させる方法について書かれています?
Re:[雑談]Hello,World
Posted: 2010年9月08日(水) 21:36
by めるぽん
Hello, world.
プログラミング言語プリプロセッサです!
cpp.exe -E -P とか cl.exe /EP とかすれば無事 Hello, world. と出力されたファイルが出てきます!とか。
Re:[雑談]Hello,World
Posted: 2010年9月08日(水) 21:44
by toyo
メッセージボックスで
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
MessageBox(NULL, TEXT("Hello World"), TEXT(""), MB_OK);
return 0;
}
Re:[雑談]Hello,World
Posted: 2010年9月08日(水) 22:03
by たかぎ
ちょっとひねりましょうか?
#include <iostream>
template <char C, class Next>
struct c
{
static char const value = C;
typedef Next type;
};
typedef c<'H',c<'e', c<'l', c<'l', c<'o', c<',', c<'W', c<'o', c<'r', c<'l', c<'d', void> > > > > > > > > > > hello;
template <class String>
void write()
{
std::cout << String::value;
write<typename String::type>();
}
template <>
void write<void>()
{
std::cout << std::endl;
}
int main()
{
write<hello>();
}
Re:[雑談]Hello,World
Posted: 2010年9月08日(水) 22:33
by シエル
適当。
#include <stdio.h>
int main(void)
{
char tmp[/url]={0x48,0x65,0x6c,0x6c,0x6f,0x2c,0x57,0x6f,0x72,0x6c,0x64};
int size=sizeof(tmp)/sizeof(tmp[0]);
for(int i=0;i<size;++i){
printf("%c",tmp);
}
printf("\n");
getchar();
return 0;
}
Re:[雑談]Hello,World
Posted: 2010年9月08日(水) 23:19
by MNS
やっつけです。
#include <stdio.h>
int main(void)
{
for(double i = 0;
i < 6;
++i)
{
putchar(-2.0167*i*i*i*i*i+23.167*i*i*i*i-87.583*i*i*i+114.33*i*i-11.9*i+72.5);
putchar(5.0167*i*i*i*i*i-66.958*i*i*i*i+310*i*i*i-572.04*i*i+330.98*i+101.5);
}
return 0;
}
Re:[雑談]Hello,World
Posted: 2010年9月09日(木) 01:25
by ideyan
うーむ、なんか微妙。。。
#include <stdio.h>
int main(void)
{
int i,j;
char *w[/url]={" "," $","\n"};
unsigned n[/url]={1744499325U,2799358541U,2816135807U,2782581325U,2130018301U,3681512887U};
for(i=0;i<5;++i){
for(j=0;j<32;++j,n>>=1){
printf(w[n&1]+((n[5]>>j)&1));
}
printf(w[2]);
}
return 0;
}
Re:[雑談]Hello,World
Posted: 2010年9月09日(木) 07:46
by へろりくしょん
すべての環境でという訳にはいきませんが、有名なコードを一つ。
char main[/url] = "`j X$@P[PYPPPPX4.4 PZUX, P^XH,=)F(P_X3F()8)8@)8@@)8)8@PYX@@@@CQBaGHello, world!\n";
Re:[雑談]Hello,World
Posted: 2010年9月09日(木) 09:38
by dic
ネットワークの伝送方法で
1h,11d,3l,7w,4l,2e,6,,10l,9r,5o,8o
と伝送順番と文字コードを一緒にして表示