Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Write a program using C or C++ that prints out "Hello World" with out using "printf" of "cout"?

user-image
Question added by Ahmed Ebrahim , Assistant Lecturer , Mekelle University
Date Posted: 2014/07/06
Yogesh Dhakad
by Yogesh Dhakad , Director Technical , Timeless Horizon Engineering Solutions

I will not write the exact program (that's what you should do yourself)

C++

a) Include headers (iostream)

b) cout << "Hello World!" << endl;

------

C

a) stdio.h

b) printf or puts a sting "Hello World!".

 

Good luck!

Khalid Omar
by Khalid Omar , Senior .NET Developer / Associate Technology Manager , Musafir.com (Universal Tourism)

There are many ways to do so:

  1. Using puts()#include<stdio.h>int main (void){   puts("Hello World");   return0;}
  2. Using putchar() #include<stdio.h>int main(void){    char*s = "hello world\\n";    while(*s) putchar(*s++);    return0;}
  3. Using assembly (source: http://en.wikipedia.org/wiki/List_of_Hello_world_program_examples).486p         .model  flat,STDCALLinclude  win32.inc extrn            MessageBoxA:PROCextrn            ExitProcess:PROC .data HelloWorld db "Hello, world!",0msgTitle db "Hello world program",0 .codeStart:         push    MB_ICONQUESTION + MB_APPLMODAL + MB_OK         push    offset msgTitle         push    offset HelloWorld         push   0         call    MessageBoxA          push0         call ExitProcessendsend Start

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.