Ok, I was the one to post the code. (I didn't give away anything.) I also am a retrired teacher.
...
The two's complement is a nontrivial concept. Someone who doesn't feel competent at least on a level to be able to start with a task as posted, will also not be able to understand and to apply the concept except in a purely mechanical way.
Isn't it the teacher's role to prepare the basis and to answer questions?
Of course the task at hand is not trivial.
The fact that one's complement and two's complement implementation is asked for implies that the student is supposed to understand what that is (I would have to google that).
The problem I am having with TS is that he did not show us that he (or
his friend) made any effort at all.
I do not even require him to show me working code.
I want to see that he has thought about the problem and has at least tried to make an algorithm to solve the problem at hand.
This can be in "natural language" or pseudo code.
I would at least have expected (for "direct" method) that he would have come up with a solution that involves repeated "divide by 2 and see what the remainder is".
From that concept we could have helped him.
If so: Can anybody here help by hints to find a way to write a Pascal routine for the conversion? Can we do it ourselves from scratch extemporizing?
For the most simple implementation: yes we can.
For one's complement: I think I can, for two's complement I would probably have to ask for help as well.
Difference is that for me this would not be homework and people around here know I'm legit, so they are probably inclined to give me sample code or point me to resources that help me make my own implementation.
Can we be sure that the task was thoroughly prepared and clearly put by the teacher?
I sincerely hope so.
Everything may be completeky differnt, of course, from what I supposed. No factual information so far!
Because TS did not respond at all.
He has moved on to another forum where he got a ready-made answer and submitted that (or he has failed because the deadline has expired).
Bart