1. The first input loop uses the wrong index
cin>> arr[5]
2. Typo in second loop header:
for(int j=0;i<5;j++)
3. One line later, same error as described in 1.
4. The whole code block after the input refers to single array elements using the index values
i
and
j
, but these values are never changed - you are missing a loop here.
Think about what a half adder does, and then how you call it. Rather than write the code for the half adder into
main()
, write a separate function, and call that from
main
- remember that as you have 5 digits to deal with, you need to call that half adder at least 5 times.
I'd think that most of the above paragraph should be in your instructions already, or in whatever book the instructor is basing the lessons on. Look there for more details.