Question: Hello, I need help with this assignment using ADA programig. I need to write an ADA program that performs multiplication, I have to ddeclare to
Hello, I need help with this assignment using ADA programig. I need to write an ADA program that performs multiplication, I have to ddeclare to arrays of size 3 by 5 of intergers. Load the arrays from an external file of random intergers. Design the array ADT to enforce all range constraints (index ranges and value ranges). Make both ranges large enought to run the program without raising an exception. So if the value range of the inout numbers is 1...300, then the value range of the intergers inthe result array must include larger values since is multiplication. iput file is lab07.in and out put file is lab07.out. Perform the multiplication as a(1,1)*b(1,1)=c(1,1)
a(1,2)*b(1,2)=c(1,2)
a(1,3)*b(1,3)=c(1,3) ................a(3,5)*b(3,5)=c(3,5)
________This is what I have so far in my program(file lab07.adb).________________________________________________________________________________
with Ada.Text_IO; -- similar to include 2 use Ada.Text_IO; -- similar to namespace 3 with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; 4 5 procedure lab07 is 6 7 MAX_ROW : constant := 3; 8 MAX_COL : constant := 5; 9 10 type MATRIX is array(INTEGER range 1..MAX_ROW, INTEGER range 1..MAX_COL) 11 of INTEGER;
12 -- example of aggregate initialization
13 grid1 : MATRIX;
14 grid2 : MATRIX; 15 grid3 : MATRIX; 16 17 begin 18 Create(outf, Out_File, "lab07.out"); -- create and open file for writing 19 Open(inf, In_File, "lab07.in"); -- open file for reading 20 21 22 --++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++ 23 end lab07; ~
_________________lab07.in________________________________________________________________________
1 3 8 4 10 2 4 38 43 4 8 12 32 16 6 2 23 8 9 9 18 41 11 21 12 2 1 6 33 11 22
_______________________________________________________________________________________________
Create lab07.out file.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
