Name: Anonymous 2013-01-31 15:36
Write a program that displays "Hello world" (without quotes) to the screen.
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
#!/usr/bin/tail -n1
Hello, World!
#include <stdio.h>
int main(int argc, char ** argv)
{
printf("Hello" " " "world");
return 0;
}
#include <windows.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
class PrintClass
{
public:
PrintClass();
~PrintClass();
char * strPrint;
}
PrintClass::~PrintClass()
{
; // so it does nothing. Thanks Tim!
}
// string must never be longer than 2^32!
PrintClass::PrintClass(char * argument)
{
strPrint = (char *)malloc(4294967296 * sizeof(char*) + 1); //large enough for any usage :)
//now to store the string for printing
strPrint = &argument; // points at to argument
cout << strPrint; // print
}
int main()
{
PrintClass * d = new PrintClass("Hello World!");
return 0;
}
#include <windows.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <stdarg.h>
using namespace std;
class ByteClass
{
public
ByteClass(unsigned int len, ...);
~ByteClass();
char * ConvertByteClassBytesToChars(int len);
unsigned int * bytes;
}
ByteClass::~ByteClass()
{
;
}
ByteClass::ByteClass(unsigned int len, ...)
{
bytes = (unsigned int *)malloc(len * sizeof(unsigned int *) + 1);
va_list ap;
va_start(ap, len); // ???
for(int i = 0; i <= len - 1; i++)
{
bytes[i] = (char) va_arg(ap, unsigned int); //???
}
va_end(ap);
}
char * ByteClass::ConvertByteClassBytesToChars(int len)
{
char * chars = (char *)malloc(4294967296 * sizeof(char*) + 1);
for (int i = 0; i <= len - 1; i++)
{
chars[i] = (char) bytes[i];
}
return chars;
}
class PrintClass
{
public:
PrintClass();
~PrintClass();
char * strPrint;
}
PrintClass::~PrintClass()
{
; // so it does nothing. Thanks Tim!
}
// string must never be longer than 2^32!
PrintClass::PrintClass(char * argument)
{
strPrint = (char *)malloc(4294967296 * sizeof(char*) + 1); //large enough for any usage :)
//now to store the string for printing
strPrint = &argument; // points at to argument
cout << strPrint; // print
}
int main()
{
ByteClass b = new ByteClass(0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21, 0x00);
PrintClass * d = new PrintClass(ConvertByteClassBytesToChars(1000));
return 0;
}
section .rodata
hstr: db 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20 ,0x77, 0x6f, 0x6c, 0x72, 0x64, \
0x21, 0x0a
section .text
global _start
_start:
mov rax, 1
mov rdi, 1
mov rsi, hstr
mov rdx, 13
syscall
mov rax, 60
xor rdi, rdi
syscall
#include <stdio.h>
#define STR(x) #x
int
main(void)
{
printf(STR(Hello world%c), 0x0a);
return 0;
}
main() {
printf("\"Hello world\" (without quotes)");
}
import java.io.OutputStreamWriter
; import java.io.BufferedWriter
; public class HelloWorld
{ public static void main(String[]commandLineArguementStringArray)
{ char[]charArrayHelloWorld=new char[]
{ 72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100
}
; OutputStreamWriter printToStdout=new OutputStreamWriter(System.out)
; BufferedWriter bufferedOutputPrint=new BufferedWriter(printToStdout)
; int iterator=0
; int helloWorldArrayLength=charArrayHelloWorld.length
; while(iterator<helloWorldArrayLength)
{ char currentCharacter=charArrayHelloWorld[iterator]
; try
{ bufferedOutputPrint.write(currentCharacter)
;
} catch(java.io.IOException inputOutputException)
{ inputOutputException.printStackTrace()
;
} iterator=iterator+1
;
} try
{ bufferedOutputPrint.flush()
; printToStdout.flush()
; bufferedOutputPrint.close()
; printToStdout.close()
;
} catch(java.io.IOException inputOutputException)
{ inputOutputException.printStackTrace()
;
} return
;
}
}
/* /prog/ C Standard: 2013-01 <hello_world.h>, v0.1 */
/* Copyright (C) 2013 /prog/ libc Foundation, Inc.
This file is part of the /prog/ C Library.
The /prog/ C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The /prog/ C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the /prog/ C Library; if not, see
<http://www.gnu.org/licenses/>;.
*/
#ifndef PROG_HELLO_WORLD_H
#define PROG_HELLO_WORLD_H
/* Prints "Hello world" (without the quotes) on to the screen. /prog/ C standard
* 201301 defines quotes as harmful characters. The standard says that
* "Hello world" should be printed without quotes, and is ambigous in whether it
* should be in the source code or not. The standard does not define how the
* string is initialized, nor the presence of EOL after the string, nor it's
* return value. Returns 0 if "Hello world" is successfully printed,1 on
* failure.
*/
extern int hello_world(int, char **);
#endif
#if __PROGCSTD__ < 201301
#define hello_world(x, y) 0
#endif/* /prog/ C Standard: 2013-01 <hello_world.c>, v0.1 */
/* Copyright (C) 2013 /prog/ libc Foundation, Inc.
This file is part of the /prog/ C Library.
The /prog/ C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The /prog/ C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the /prog/ C Library; if not, see
<http://www.gnu.org/licenses/>;. */
#include <hello_world.h>
#include <stdio.h>
#include <string.h>
#undef safeprint
#undef safestrcmp
#undef hello_world
/* we use printf(3) and strcmp(3) which allow string literals to passed as
* arguments. These macros are temporary workarounds for when printf and strcmp
* become /prog/ C standard compilant.
*/
#define safeprintf(x, ...) printf(#x, __VA_ARGS__)
#define safestrcmp(x, y) strcmp(#x, y)
int hello_world(int n, char **src) {
/* This eliminates all quotes */
if(n == 3) {
/* we only want to print "Hello world" */
if(safestrcmp(Hello, src[1]) == 0
&& safestrcmp(world, src[2]) == 0)
if(safeprintf(%s %s, src[1], src[2]) < 0) return 1;
else return 1;
}
else return 1;
putchar(10);
return 0;
}
#include <hello_world.h>
int main(int argc, char **argv) {
return hello_world(argc, argv);
}
--- hello_world.c.orig 2013-02-02 03:18:40.534394992 +0500
+++ hello_world.c 2013-02-02 03:15:34.768675391 +0500
@@ -37,6 +37,7 @@
if(safestrcmp(Hello, src[1]) == 0
&& safestrcmp(world, src[2]) == 0)
if(safeprintf(%s %s, src[1], src[2]) < 0) return 1;
+ else ;
else return 1;
}
else return 1;