🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.pascal.misc
5 messages
5 total messages Started by Joshua Roth Thu, 07 Jan 1999 00:00
New to pascal, need help w/ program
#138
Author: Joshua Roth
Date: Thu, 07 Jan 1999 00:00
27 lines
2368 bytes
I'm currently taking a Pascal course as a requirement for my major, and my
instructor is probably the worst instructor I've ever had. I now have
homework due in less then a week, and I have know clue how to do it. Can
anyone help me out? Here is the problem:

Make the unrealistic assumption that your computer has maxint equal to 18,
and write a program to read in two numbers of 10 or fewer digits and output
their sum. The two numbers are stored in arrays of the following type:

              type
                 Number = array[0...9] of integer;

Each digit of a number is stored in one indexed variable of it's array. The
numbers are to be read as character values, one digit at a time, using a
variable of type char. Each digit is converted into a number and stored in
an indexed variable of an array. If the number is less than 10 digits long,
then leading zeros should be added to the array.
an addition procedure is then called to calculate the sum and stored it in a
third array. If the sum would be more than 10 digits long, the two numbers
read in and their sum are output.

I only have four days before this is due, and I'm at a lost. Can anyone
help.......I'm desperate

                                              josh

                                  joshroth@pacbell.net
Re: New to pascal, need help w/ program
#139
Author: Mike Copeland
Date: Thu, 07 Jan 1999 00:00
28 lines
2497 bytes
> I'm currently taking a Pascal course as a requirement for my major, and my
> instructor is probably the worst instructor I've ever had. I now have
> homework due in less then a week, and I have know clue how to do it. Can
> anyone help me out? Here is the problem:
> 
> Make the unrealistic assumption that your computer has maxint equal to 18,
[deleted]
> I only have four days before this is due, and I'm at a lost. Can anyone
> help.......I'm desperate

   I'm sure you are...but where were you during the semester's classes 
and assignments?  Was this instructor so "bad" he/she wouldn't answer any 
questions or provide explanations? 
   Here you are, and the end of this class, no doubt having done no work 
whatsoever so far, and all you can do is "blame the rotten instructor".  
Do you know how many times these NGs have seen lame and pathetic begging 
almost identical to yours?  
   Well, you're not going to get any sympathy or specific code help here, 
because giving homework/assignment programs to such as you just isn't 
done.  Had you posted anything more than this groveling - such as some 
design or code you've already done - we would have been willing to offer 
help.  Since you didn't (and thereby demonstrating no personal 
initiative), why should anyone rush to your aid, to give you code to hand 
in and "slide" with, so you'll learn absolutely nothing about Pascal 
programming or problem solving?  
   Is that how you'll deal with every "tough situation" throughout the 
rest of your life?
   <sigh...>
Re: New to pascal, need help w/ program
#140
Author: Bob Schor
Date: Fri, 08 Jan 1999 00:00
53 lines
2883 bytes
Joshua Roth wrote:

> I'm currently taking a Pascal course as a requirement for my major,
> and my
> instructor is probably the worst instructor I've ever had. I now have
> homework due in less then a week, and I have know clue how to do it.
> Can
> anyone help me out? Here is the problem:
>
> Make the unrealistic assumption that your computer has maxint equal to
> 18,
> and write a program to read in two numbers of 10 or fewer digits and
> output
> their sum. The two numbers are stored in arrays of the following type:
>
>               type
>                  Number = array[0...9] of integer;
>
> Each digit of a number is stored in one indexed variable of it's
> array. The
> numbers are to be read as character values, one digit at a time, using
> a
> variable of type char. Each digit is converted into a number and
> stored in
> an indexed variable of an array. If the number is less than 10 digits
> long,
> then leading zeros should be added to the array.
> an addition procedure is then called to calculate the sum and stored
> it in a
> third array. If the sum would be more than 10 digits long, the two
> numbers
> read in and their sum are output.

     One hint.  Pretend you are in Second Grade.  When you learned your
"Plus
tables", the highest number you ever dealt with was 18.  How did you add
two
10-digit numbers?  [As the mathematicians would say, these two problems
are
isomorphic ...].

Bob Schor
Pascal Enthusiast

P.S. -- Why not actually TRY to do this problem?  Think about an
algorithm, and give
it a try.  When dealing with a BIG problem ("Add two 10-digit numbers"),
first try to
make it a SMALL problem ("Add two one-digit numbers"), then think about
how to
make it bigger (if I can add one-digit numbers, what "extra" do I have
to do to add
two-digit numbers?).
Re: New to pascal, need help w/ program
#141
Author: Irv Mullins
Date: Mon, 11 Jan 1999 00:00
15 lines
1384 bytes
Joshua Roth wrote:

> I'm currently taking a Pascal course as a requirement for my major, and my
> instructor is probably the worst instructor I've ever had. I now have
> homework due in less then a week, and I have know clue how to do it. Can
> anyone help me out? Here is the problem:
>
> I only have four days before this is due, and I'm at a lost. Can anyone
> help.......I'm desperate

Josh: I have only four days until my taxes are due.
I didn't save any money this year, so I'm also desperate.
How much help do I deserve?

Irv
Re: New to pascal, need help w/ program
#142
Author: P. Baeumle-Courth
Date: Fri, 22 Jan 1999 00:00
5 lines
1222 bytes
Irv Mullins wrote:
> Joshua Roth wrote:
> > I'm currently taking a Pascal course as a requirement for my major, and my ...

Isn't this a German newsgroup??
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads