Differences
This shows you the differences between two versions of the page.
— |
equality [2012/01/24 08:11] (current) thomaslocke created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <code ada> | ||
+ | with Ada.Text_IO; | ||
+ | with Ada.Text_IO.Unbounded_IO; | ||
+ | with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; | ||
+ | with Ada.Containers.Vectors; use Ada.Containers; | ||
+ | |||
+ | procedure Quotes is | ||
+ | package IO renames Ada.Text_IO; | ||
+ | package SUIO renames Ada.Text_IO.Unbounded_IO; | ||
+ | package Quote_Container is new Vectors (Natural, Unbounded_String); | ||
+ | use Quote_Container; | ||
+ | Quotes : Vector; | ||
+ | Foo : Vector; | ||
+ | Input : IO.File_Type; | ||
+ | begin | ||
+ | IO.Open (File => Input, | ||
+ | Mode => IO.In_File, | ||
+ | Name => "quotes.txt"); | ||
+ | while not IO.End_Of_File (File => Input) loop | ||
+ | Quotes.Append (New_Item => SUIO.Get_Line (File => Input)); | ||
+ | end loop; | ||
+ | IO.Close (Input); | ||
+ | |||
+ | if Quotes = Foo then | ||
+ | IO.Put_Line (Item => "Quotes and Foo are equal"); | ||
+ | else | ||
+ | IO.Put_Line (Item => "Quotes and Foo are NOT equal"); | ||
+ | end if; | ||
+ | |||
+ | Foo.Append (New_Item => Quotes); | ||
+ | |||
+ | if Quotes = Foo then | ||
+ | IO.Put_Line (Item => "Quotes and Foo are equal"); | ||
+ | else | ||
+ | IO.Put_Line (Item => "Quotes and Foo are NOT equal"); | ||
+ | end if; | ||
+ | end Quotes; | ||
+ | </code> | ||
+ | |||
+ | [[Ada.Containers.Vectors#Equality | Go back]] | ||