Write the body of the following Invert
function:
function Invert (S : String) return String
...
begin
...
end Invert;
Invert
shall return the inverted string, with the same bounds as S
.
You can put this function inside a main procedure that will serve as a test procedure:
-- test_invert.adb
with Ada.Text_IO; use Ada.Text_IO;
procedure Test_Invert is
function Invert (S : String) return String
...
begin
...
end Invert;
begin
... -- Put some tests here
end Test_Invert;
Write the same subprogram, but as a procedure, that inverts the string in-place:
procedure Invert (S : in out String)
...
begin
...
end Invert;
Write associated tests.
Write a function that converts an Integer
into a String
, without using the
'Image
attribute. Start by handling positive integers, then transition to all
integers.
Write associated tests.
Write a function that converts a String
into an Integer
, with associated
tests.
Write a function that converts an Integer
into a String
using
Roman numerals.
Write the inverse function.
Write a program that shows a rectangle triangle with *
of size N*N
, using
array aggregates. For example, for N=4
:
*
**
***
****
Write a package (spec and body) that implements a singleton Integer
stack (no
type). The stack has a fixed maximum size of 512
.
The public subprograms are:
procedure Pop (V : out Integer);
procedure Push (V : Integer);
Add a Stack
private type to the previous package, to allow having several
distinct stacks in the same program.
Modify the implementation of the previous package to use a linked list instead of an array.
OR
Modify the implementation of the previous package so that the programmer can specify the size of the array when declaring the stack.
OR
Modify the implementation of the previous package so that it uses an array that is automatically resized when the programmer goes beyond the initial max size.
Make the previous package generic on the type of elements.