Jump to content

hello world();


stutters

Recommended Posts

system.out.println("Hello World");

 

btw, nofx, my c++ teacher would have taken a point off for etiquette for not having a space between << and endl;

 

what language is printf?

Your teacher is a noob, he should've taken off a point for not using namespace std.

Link to comment
Share on other sites

Member
(edited)
are we supposed to write this in our native tongue?

 

cout << "Hello World "<<endl; or

printf ("%s \n", "Hello World");

 

Corrected:

 

std::cout << "Hello World" << std::endl;

 

(void) printf("%s \n", "Hello World");

 

ever heard of "using namespace std"?

Edited by NOFX
Link to comment
Share on other sites

are we supposed to write this in our native tongue?

 

cout << "Hello World "<<endl; or

printf ("%s \n", "Hello World");

 

Corrected:

 

std::cout << "Hello World" << std::endl;

 

(void) printf("%s \n", "Hello World");

 

ever heard of "using namespace std"?

 

 

the original poster didnt use it; and i can't be sure if he is doing this in some class in some header file so to err on the safe side, i use std::

 

 

and besides, i dont use "using namespace std"...so polluting

Link to comment
Share on other sites

  • 1 month later...
10 Rem New Program!

20 Cls

30 Print "Hello World!"

40 Input "Would you like this printed? (Y/N)";A$

50 If A$<> "Y" and A$<>"N" then goto 40

60 If A$="N" then End

70 If A$="Y" then Lprint "Hello World"

80 End

 

Assembly? I haven't messed with something like this since school

Link to comment
Share on other sites

.data

sHello BYTE "Hello World!", 0

 

.code

main PROC

 

pushad

&COMMENT

This is the part where you move the thing into the other thing!

&

mov edx, OFFSET sHello

 

@COMMENT

WriteString is included in the Irvine32.inc file, fyi.@

call WriteString

popad

exit

main ENDP

Edited by DarkArchon
Link to comment
Share on other sites

10 Rem New Program!

20 Cls

30 Print "Hello World!"

40 Input "Would you like this printed? (Y/N)";A$

50 If A{:content:}lt;> "Y" and A{:content:}lt;>"N" then goto 40

60 If A$="N" then End

70 If A$="Y" then Lprint "Hello World"

80 End

 

Assembly? I haven't messed with something like this since school

 

Yup!

the original age-old "B.A.S.I.C." that I first started to learn on a Radio Shack TRS-80 Model 1 with 16k ram

Line by line and step by agonizing step.

Note: Always count your lines by ten!! That way you have 9 lines in between in case you need to add more! Otherwise, you have to re-write the program to get extra line numbers.

 

Of course, if youre the gambling sort and know you never make a mistake:

 

1 Rem New Program!
2 Cls:Print "Hello World!"
3 Input "Would you like this printed? (Y/N)";A$
4 If A$<> "Y" and A$<>"N" then goto 3 else if A$="N" then End
5 Lprint "Hello World":End

Link to comment
Share on other sites

  • 1 year later...

BITS 32

org 0x05430000

db 0x7F, "ELF"
dd 1
dd 0
dd $$
dw 2
dw 3
dd _start
dw _start - $$
_start: inc ebx ; 1 = stdout file descriptor
add eax, dword 4 ; 4 = write system call number
mov ecx, msg ; Point ecx at string
mov dl, 13 ; Set edx to string length
int 0x80 ; eax = write(ebx, ecx, edx)
and eax, 0x10020 ; al = 0 if no error occurred
xchg eax, ebx ; 1 = exit system call number
int 0x80 ; exit(ebx)
msg: db 'hello, world', 10

 

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...