Difference between revisions of "Salutare lume!"
From linux360
(→Introducere: Restored metaphor) |
(mda, cascat) |
||
(15 intermediate revisions by 9 users not shown) | |||
Line 6: | Line 6: | ||
Urmează exemplele: | Urmează exemplele: | ||
− | == | + | ==BASIC== |
+ | 10 PRINT "Hello, world!" | ||
+ | 20 STOP | ||
+ | |||
+ | ==Bourne Again Shell== | ||
<code><sh/>#!/bin/bash | <code><sh/>#!/bin/bash | ||
Line 12: | Line 16: | ||
exit 0</code> | exit 0</code> | ||
− | == | + | ==Brainfuck== |
− | < | + | ++++++++++ |
− | + | [ | |
+ | >+++++++>++++++++++>+++>+<<<<- | ||
+ | ] | ||
+ | >++. | ||
+ | >+. | ||
+ | +++++++. | ||
+ | . | ||
+ | +++. | ||
+ | >++. | ||
+ | <<+++++++++++++++. | ||
+ | >. | ||
+ | +++. | ||
+ | ------. | ||
+ | --------. | ||
+ | >+. | ||
+ | >. | ||
==ANSI C== | ==ANSI C== | ||
Line 25: | Line 44: | ||
}</code> | }</code> | ||
− | ==C++== | + | ==ANSI C++== |
<code><cpp/>#include <iostream> | <code><cpp/>#include <iostream> | ||
Line 34: | Line 53: | ||
return 0; | return 0; | ||
+ | }</code> | ||
+ | |||
+ | ==Java== | ||
+ | <code><java/>public class MainApplication { | ||
+ | public static void main(String args[]) { | ||
+ | System.out.println("Hello, world!"); | ||
+ | } | ||
}</code> | }</code> | ||
Line 42: | Line 68: | ||
writeln('Hello, world!'); | writeln('Hello, world!'); | ||
end.</code> | end.</code> | ||
+ | ==Perl== | ||
+ | <code><perl/>#!/usr/bin/perl | ||
+ | |||
+ | print "Hello, world!"; | ||
+ | </code> | ||
==PHP== | ==PHP== | ||
Line 52: | Line 83: | ||
</html></code> | </html></code> | ||
− | == | + | ==TCL== |
− | <code><java/>public class | + | <code><tcl/>#!/usr/bin/tcl |
− | public static void | + | |
− | + | puts "Hello, world!"; | |
+ | </code> | ||
+ | |||
+ | ==C#== | ||
+ | <code><java/> | ||
+ | using System; | ||
+ | |||
+ | public class MainClass | ||
+ | { | ||
+ | public static void Main () | ||
+ | { | ||
+ | Console.WriteLine ("Hello, world!"); | ||
} | } | ||
− | }</code> | + | } |
+ | </code> | ||
[[Category:Collection]] | [[Category:Collection]] | ||
[[Category:Programming]] | [[Category:Programming]] |
Latest revision as of 15:24, 9 November 2006
Contents
Introducere
Am creeat acest articol din dorinţa de a arăta lumii diversitatea limbilor existente în informatică.
Ceea ce urmează sunt moduri de a spune atât de cunoscutul Salutare, lume! (<eng. Hello, world!) în diverse limbaje de programare. Puteţi adăuga exemple noi cu condiţia să fie corecte programatic, să fie tratate în varianta standard a limbajului folosit şi să rămână sortate în ordine alfabetică.
Urmează exemplele:
BASIC
10 PRINT "Hello, world!" 20 STOP
Bourne Again Shell
<sh/>#!/bin/bash
echo "Hello, world!" exit 0
Brainfuck
++++++++++ [ >+++++++>++++++++++>+++>+<<<<- ] >++. >+. +++++++. . +++. >++. <<+++++++++++++++. >. +++. ------. --------. >+. >.
ANSI C
<c/>#include <stdio.h>
int main(void) {
printf("Hello, world!\n");
return 0;
}
ANSI C++
<cpp/>#include <iostream>
using namespace std;
int main(void) {
cout << "Hello, world!" << endl;
return 0;
}
Java
<java/>public class MainApplication {
public static void main(String args[]) { System.out.println("Hello, world!"); }
}
Pascal
<pascal/>program HelloWorld;
begin
writeln('Hello, world!');
end.
Perl
<perl/>#!/usr/bin/perl
print "Hello, world!";
PHP
<html/><html>
<body>
<?php
echo "Hello, world!";
?>
</body>
</html>
TCL
<tcl/>#!/usr/bin/tcl
puts "Hello, world!";
C#
<java/>
using System;
public class MainClass {
public static void Main () { Console.WriteLine ("Hello, world!"); }
}