From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fd8c808621763c34,start X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: help Please Date: 1999/01/24 Message-ID: #1/1 X-Deja-AN: 436459634 Sender: matt@mheaney.ni.net References: <36ab9be5.2873369@news.ptd.net> NNTP-Posting-Date: Sun, 24 Jan 1999 14:53:46 PDT Newsgroups: comp.lang.ada Date: 1999-01-24T00:00:00+00:00 List-Id: rross@postoffice.ptd.net (bob) writes: > hey, i am a student and i cant seem to figure this out: > we are to add two integer numbers together , assuming that the > computer > doesnt know how to add. for example , you read two integers into an > array > of characters each. > then you add the numbers together in a for loop: > > for a in reverse (1..10) loop > --Z is the 3rd array or result array > Z(a) := A(a)+B(a)+carry; > > something like that, where carry is if you have a sum of more than 10, > which is decided in an if statement later in the loop > > my problem is: we are supposed to use array A and B as type > characters. > you cant add two characters and you cant typecast them to integers, so > how > do u get the result of the sums into Z? > any help on this would be greatly appreciated > thanks in advance If you want to add two characters together, then just define an operator to do that: function "+" (L, R : Character) return Character is ...; You can't "typecast" a character to integer, like this ... Integer (C) ... but of course you can convert a character into its underlying integer representation either by using Unchecked_Conversion or Character'Pos.