Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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

user-image
Question ajoutée par Ahmed Ebrahim , Assistant Lecturer , Mekelle University
Date de publication: 2014/07/06
Yogesh Dhakad
par 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
par 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

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?