Hello world/Text: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
Line 6: Line 6:


==[[Ada]]==
==[[Ada]]==
[[Category:Ada]]
'''Compiler:''' [[GCC]] 4.1.2
'''Compiler:''' [[GCC]] 4.1.2


Line 15: Line 16:


==[[BASIC]]==
==[[BASIC]]==
[[Category:BASIC]]


'''Compiler:''' [[BASICA]]
'''Compiler:''' [[BASICA]]
Line 22: Line 24:


==[[C]]==
==[[C]]==
[[Category:C]]


'''Compiler Suite:''' [[GCC]] 4.0.1
'''Compiler Suite:''' [[GCC]] 4.0.1
Line 36: Line 39:


==[[C plus plus|C++]]==
==[[C plus plus|C++]]==
[[Category:C plus plus|C++]]


'''Compiler Suite:''' [[GCC]] 4.1.2, [[Visual Studio]] 2005
'''Compiler Suite:''' [[GCC]] 4.1.2, [[Visual Studio]] 2005
Line 50: Line 54:
}
}


==[[C Sharp|C#]]==
==[[C sharp|C#]]==
[[Category:C sharp|C#]]


'''Compiler Suite:''' All should work, tested on Mono 1.2
'''Compiler Suite:''' All should work, tested on Mono 1.2
Line 57: Line 62:


==[[Java]]==
==[[Java]]==
[[Category:Java]]


'''Compiler:''' any Java compiler should do
'''Compiler:''' any Java compiler should do
Line 63: Line 69:


==[[Lua]]==
==[[Lua]]==
[[Category:Lua]]


'''Interpreter:''' [[Lua]] 5.1.1
'''Interpreter:''' [[Lua]] 5.1.1
Line 75: Line 82:


==[[mIRC]]==
==[[mIRC]]==
[[Category:mIRC]]


'''Editor:''' [[mIRC Script Editor]]
'''Editor:''' [[mIRC Script Editor]]
Line 81: Line 89:


==[[OCaml]]==
==[[OCaml]]==
[[Category:OCaml]]


print_endline "Goodbye, World!"
print_endline "Goodbye, World!"


==[[Pascal]]==
==[[Pascal]]==
[[Category:Pascal]]

'''Compiler:''' [[Free Pascal]]
'''Compiler:''' [[Free Pascal]]


Line 93: Line 104:


==[[Perl]]==
==[[Perl]]==
[[Category:Perl]]


'''Interpreter:''' [[Perl]] 5.8.8
'''Interpreter:''' [[Perl]] 5.8.8
Line 99: Line 111:


==[[PHP]]==
==[[PHP]]==
[[Category:PHP]]


echo "Goodbye, World!\n";
echo "Goodbye, World!\n";


==[[Python]]==
==[[Python]]==
[[Category:Python]]


'''Interpreter:''' [[Python]] 2.4
'''Interpreter:''' [[Python]] 2.4
Line 109: Line 123:


==[[Ruby]]==
==[[Ruby]]==
[[Category:Ruby]]

'''Interpreter:''' [[Ruby]] 1.8.4
'''Interpreter:''' [[Ruby]] 1.8.4


Line 116: Line 132:


==[[UNIX Shell]]==
==[[UNIX Shell]]==
[[Category:UNIX Shell]]


'''Interpreter:''' [[Bourne Again SHell]] (bash)
'''Interpreter:''' [[Bourne Again SHell]] (bash)
Line 125: Line 142:


==[[C plus plus|C++]]==
==[[C plus plus|C++]]==
[[Category:C plus plus|C++]]

'''Compiler Suite:''' [[GCC]] 3.3.5
'''Compiler Suite:''' [[GCC]] 3.3.5
'''Library:''' [[gtkmm]]
'''Library:''' [[gtkmm]]
Line 136: Line 155:


==[[Java]]==
==[[Java]]==
[[Category:Java]]

'''Interpreter:''' [[Java]]
'''Interpreter:''' [[Java]]
'''Library:''' [[Swing]]
'''Library:''' [[Swing]]
Line 146: Line 167:


==[[Python]]==
==[[Python]]==
[[Category:Python]]

'''Interpreter:''' Python 2.5
'''Interpreter:''' Python 2.5
'''Library:''' Tkinter API (using tkMessageBox helper class)
'''Library:''' Tkinter API (using tkMessageBox helper class)
Line 153: Line 176:


==[[Visual Basic .NET]]==
==[[Visual Basic .NET]]==
[[Category:Visual Basic .NET]]

'''Compiler Suite:''' [[Visual Studio]] 2005
'''Compiler Suite:''' [[Visual Studio]] 2005
Module GoodbyeWorld
Module GoodbyeWorld

Revision as of 02:23, 24 January 2007

Task
Hello world/Text
You are encouraged to solve this task according to the task description, using any language you may know.

In the User Output task, the goal is to display the string "Goodbye, World!"

Text Terminal

Ada

Compiler: GCC 4.1.2

with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
begin
  Put_Line ("Goodbye, World!");
end Main;

BASIC

Compiler: BASICA

10 print "Goodbye World!"


C

Compiler Suite: GCC 4.0.1

#include <stdio.h>

int main(int argc, char **argv)
{
  printf("Goodbye, World!\n");

  return 0;
}


C++

Compiler Suite: GCC 4.1.2, Visual Studio 2005

#include <iostream>

using std::cout;
using std::endl;

int main () {
  cout << "Goodbye, World!" << endl;

  return 0;
}

C#

Compiler Suite: All should work, tested on Mono 1.2

System.Console.WriteLine("Goodbye, World!");

Java

Compiler: any Java compiler should do

System.out.println("Goodbye, World!");

Lua

Interpreter: Lua 5.1.1

print("Goodbye, World!")

or:

print "Goodbye, World!"

In Lua, parentheses are optional for function calls when there is only one argument and this argument is either a string or a table constructor.

mIRC

Editor: mIRC Script Editor

alias saygoodbye { echo -a Goodbye! }

OCaml

print_endline "Goodbye, World!"

Pascal

Compiler: Free Pascal

program byeworld;
begin
 writeln('Goodbye, World!');
end.

Perl

Interpreter: Perl 5.8.8

print "Goodbye, World!\n";

PHP

echo "Goodbye, World!\n";

Python

Interpreter: Python 2.4

print "Goodbye, World!"

Ruby

Interpreter: Ruby 1.8.4

puts "Goodbye, World!"

or

$stdout.puts "Goodbye, World!"

UNIX Shell

Interpreter: Bourne Again SHell (bash)

#!/bin/bash
echo "Goodbye World!"

GUI

C++

Compiler Suite: GCC 3.3.5 Library: gtkmm

#include <gtkmm.h>
int main(int argc, char *argv[])
{
   Gtk::Main app(argc, argv);
   Gtk::MessageDialog msg("Goodbye, World!");
   msg.run();
}

Java

Interpreter: Java Library: Swing

import javax.swing.*;
public class OutputSwing {
    public static void main(String[] args) throws Exception {
        JOptionPane.showMessageDialog (null, "Goodbye, World!");
    }
}

Python

Interpreter: Python 2.5 Library: Tkinter API (using tkMessageBox helper class)

 import tkMessageBox
 
 print tkMessageBox.showinfo("Some Window Label", "Goodbye, World!")

Visual Basic .NET

Compiler Suite: Visual Studio 2005

Module GoodbyeWorld
    Sub Main()
        Messagebox.Show("Goodbye, World!")
    End Sub
End Module