I am trying to create a decrement program in SPARK Ada. D1 to D3 are the input digits entered by the user and the program asks to decrement a 3 digit number by one and output 3 digits O1, O2, O3. I am not sure how to modify this to element of type digits. Then I will adapt it so the numbers are given as a record type consisting of 3 digits. Any help to helpful websites/explanation will be highly appreciated.
Eg1 of program) if d1=1 d2=2 d3=3 then output = 122. Eg2 of program) input d1=0 d2=0 d3=0 then output = 999.
This is my source code so far:
pragma SPARK_Mode;
package Decrement is
type d1 is new Integer range 0 .. 9;
type d2 is new Integer range 0 .. 9;
type d3 is new Integer range 0 .. 9;
procedure Dec(d1,d2,d3 : in Integer; o1,o2,o3 : out Integer);
end Decrement;