Skip to content

Instantly share code, notes, and snippets.

@elliptic-shiho
Last active August 29, 2015 14:15
Show Gist options
  • Save elliptic-shiho/9b1631f03b03e91f7189 to your computer and use it in GitHub Desktop.
Save elliptic-shiho/9b1631f03b03e91f7189 to your computer and use it in GitHub Desktop.
Polyglot
#include <stdio.h>
#define sub void
#define main main()
#define print printf
#define x1
#if 0
main();
#endif
sub main {
print ("Hello World!"x1);
}
#include <stdio.h>
#define sub void
#define main main()
#define print printf
#define x1
#if 0
qw="""=;
#endif
sub main {
print ("Hello World!"x1);
}
#if 0
main();
__END__
"""
print "Hello World!"
#endif
#<?php echo "Hello World!"; __halt_compiler(); ?>
#include <stdio.h>
#define sub void
#define main main()
#define print printf
#define x1
#if 0
qw="""=;
#endif
sub main {
print ("Hello World!"x1);
}
#if 0
main();
__END__
"""
print "Hello World!"
#endif
#ifndef __cplusplus
# include <stdio.h>
#else
# include <iostream>
#endif
#if 0
qw='''=; #';
eval 'echo Hello World!;exit; #' if !1;
qw#'''#;
qw='''=;
print "Hello World!\n";
<<s
'
puts "Hello World!"
<<s
'''
print "Hello World!"
"""
#endif
int main() {
#ifndef __cplusplus
puts("Hello World!");
#else
std::cout<<"Hello World!"<<std::endl;
#endif
return 0;
}
#if 0
s
;
qw#"""#;
#endif
// \u000a /*
#if 0
echo "Hello, Bash!";exit 0;
#endif
#ifdef __cplusplus
#include <iostream>
int main(){std::cout << "Hello, C++!" << std::endl;return 0;}
#else
#include <stdio.h>
int main(){puts("Hello, C!");return 0;}
#endif
#if 0
// \u000a */
public class polyglot{public static void main(String args[]){System.out.println("Hello, Java!");}}
//\u000a /*
#endif
// */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment