Terminal control/Display an extended character: Difference between revisions

From Rosetta Code
Content added Content deleted
(Added Ada)
m (Added Ada unicode example.)
Line 13: Line 13:
Put(Ada.Characters.Latin_1.Pound_Sign);
Put(Ada.Characters.Latin_1.Pound_Sign);
end Pound;</lang>
end Pound;</lang>

Ada allows Unicode characters in the source, and provides output functions on "wide characters".

<lang ada>with Ada.Wide_Text_IO; use Ada.Wide_Text_IO;

procedure Unicode is
begin
Put("札幌");
end Unicode;</ada>


=={{header|BASIC}}==
=={{header|BASIC}}==

Revision as of 20:28, 26 December 2010

Terminal control/Display an extended character is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

The task is to display an extended (non ascii) character onto the terminal. For this task, we will display a £ (GBP currency sign).

Ada

<lang ada>with Ada.Text_IO; use Ada.Text_IO; with Ada.Characters.Latin_1;

procedure Pound is begin

  Put(Ada.Characters.Latin_1.Pound_Sign);

end Pound;</lang>

Ada allows Unicode characters in the source, and provides output functions on "wide characters".

<lang ada>with Ada.Wide_Text_IO; use Ada.Wide_Text_IO;

procedure Unicode is begin

  Put("札幌");

end Unicode;</ada>

BASIC

ZX Spectrum Basic

The ZX Spectrum uses a modified ascii character set that has a uk pound sign at character number 96:

<lang basic> 10 PRINT CHR$(96); </lang>

J

<lang J> '£' £

  '札幌'

札幌</lang>

PicoLisp

<lang PicoLisp>(prinl (char 26413) (char 24140)) # Sapporo </lang> Output:

札幌

PureBasic

<lang PureBasic>Print(Chr(163))</lang>

£