Linguagem Ada
Autor: -_-Everlan-_- | Publicado: 2011-04-27T06:56:00-07:00


 <!--
  @page { margin: 2cm }
  P { margin-bottom: 0.21cm }
  TT.cjk { font-family: "DejaVu Sans", monospace }
 -->
 
  
Linguagem de programação em adaO nome Ada é uma homenagem a condessa de Lovelace que se chamava Augusta Ada Byron, filha de Lord Byron que trabalhava com Charles Babbage e ela é a primeira programadora de computadores.Ada é uma linguagem de programação de alto nível e imperativa baseada em Pascal e criada através do departartamento de defesa (DoD).Ela foi desenvolvida para ser mais do que apenas mais uma linguagem de programação, já que ela inclui muitos dos princípios modernos de engenharia de software. Por exemplo, o conceito de ocultação de informação foi inserido na linguagem ao invés de ser implementado como uma técnica de programação.&nbsp;Comando if-Exemplo
 <!--
  @page { margin: 2cm }
  P { margin-bottom: 0.21cm }
 -->
 
  With text_IO; Use text_IO;With Ada.Integer_Text_IO; Use Ada.Integer_Text_IO;Procedure usando_if is x, y : integer;begin New_Line(3); Put("Digite o primeiro valor: "); Get(x); Put("Digite o segundo valor: "); Get(y); New_Line;       if x&gt;y then  Put_Line("O Primeiro valor digitado e' maior!"); elsif x&lt;y then  Put_Line("O Segundo valor digitado e' maior!"); else  Put_line("Os dois valores são iguais."); end if; New_Line(3); end usando_if;&nbsp;Programa em Ada&nbsp;-- Ada version of 99 Bottles of Beerwith Ada.Text_IO;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; use Ada.Text_IO;with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;procedure Bottles is&nbsp;&nbsp;&nbsp;&nbsp; count : Integer := 99;begin&nbsp;&nbsp;&nbsp;&nbsp; while count &gt; 0 loop&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Put (count, Width=&gt;0);&nbsp; Put_Line (" bottles of beer on the wall,");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Put (count, Width=&gt;0);&nbsp; Put_Line (" bottles of beer.");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Put_Line ("Take one down and pass it around.");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; count := count - 1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if count = 0 then&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Put_Line("No bottles of beer on the wall!");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Put (count, Width=&gt;0);&nbsp; Put_Line (" bottles of beer on the wall.");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end if;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; New_Line;&nbsp;&nbsp;&nbsp;&nbsp; end loop;end Bottles;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Tradução- Ada versão de 99 garrafas de cerveja
com Ada.Text_IO; uso Ada.Text_IO;
com Ada.Integer_Text_IO; uso Ada.Integer_Text_IO;
Garrafas procedimento é
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Contagem: Integer: = 99;
começar
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; enquanto a contagem&gt; 0 loop
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Coloque (contagem, Largura =&gt; 0); Put_Line ("garrafas de cerveja no muro ",);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Coloque (contagem, Largura =&gt; 0); Put_Line ("garrafas de cerveja.");
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Put_Line ("Tome uma e passá-lo por perto.");
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; contagem: contagem = - 1;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; se a contagem = 0 então
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Put_Line ("Nada de garrafas de cerveja na parede!");
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mais
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Coloque (contagem, Largura =&gt; 0); Put_Line ("garrafas de cerveja na parede.");
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fim se;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; New_Line;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; loop fim;
Garrafas fim;