delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/02/09/21:11:27

From: "Alexei A. Frounze" <dummy_addressee AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: I think this is a for problem...
Date: Fri, 9 Feb 2001 20:58:10 -0500
Lines: 77
Message-ID: <96275a$j0cbu$1@ID-57378.news.dfncis.de>
References: <pSVg6.203456$ge4 DOT 69048244 AT news2 DOT rdc2 DOT tx DOT home DOT com> <961ogo$j1fr2$1 AT ID-57378 DOT news DOT dfncis DOT de> <BC_g6.204378$ge4 DOT 69440369 AT news2 DOT rdc2 DOT tx DOT home DOT com>
NNTP-Posting-Host: pppa26-resalerochester5-5r7108.dialinx.net (4.4.217.215)
X-Trace: fu-berlin.de 981770221 19935614 4.4.217.215 (16 [57378])
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Bob & Chris Parrish" <Rcprrsh AT cs DOT com> wrote in message
news:BC_g6.204378$ge4 DOT 69440369 AT news2 DOT rdc2 DOT tx DOT home DOT com...
> If I could solve it from the textbook examples, I wouldn't have asked.
Most
> everyone has been very helpful.  Thanks for your awesome explanation - you
> are very helpful (not)!

Come on, you have been given an assignement. A very clear one.
1st thing you must have done is not really about C or whatever the language
is. You must have decomposed the problem into several smaller and simpler
ones and then make a simple solution for each of thenm finally bringing all
those pieces together. This is what evreything is about. For instance, if
you were asked to send a latter to your cousin and ask about something,
nobody would tell you that you must perform such simple actions as follows:
- get an envelope
- get a stamp
- get some paper
- get a pen
- write the letter (character by character)
- fold the sheet
- put inside
- close the envelope
- apply the stamp
- take on the clothers
- go out
- stop by the nearest mailbox or postoffice or whatever
- drop the envelope
You *are* capable to split every task (even if it looks hard or impossible)
into several smaller and simpler ones which you always can solve easily. Is
the above list somewhat complicated? Nope. You perfectly realize each item
on that list. So what's the prob? Why not to do same with your program? Just
don't put everything into C functions and operators from scratch. Make a
more abstract thing like the list above, add there something like arrows or
"goto" things to mark the program flow (btw, very often it's simpler to draw
a program flow diagram out of a few bircks such that rectangle="do
something", rhomb="compare something to something" and two (or more) arrows
go out of the rhomb pointing to "do something" bricks which must be executed
in each result of the comparison (e.g. for "bigger" "go A", for "equal" "go
B") and when you're done with the design just look through the stuff C is
capable of and pick up what fits your needs. Is what I'm telling here
something that does not make sense at all? Isn't it what all good teachers
propose to do (e.g. split every task into smaller/simpler and solve all of
them eventually solving the whole task instead of just saying "I can not."
and giving up thinking). Try to do this w/o C at 1st place. Apply C stuff
onto the diagram of your program only when you're done with the design.
Basically, all of the above text shouldn't be a topic in a book on a
programming language. This is a programming-language-independent procedure
and thus it has not much to do with C or Pascal or Assembler language or
something esle. This conception is used everywhere. I guess there might be a
different kind of book which covers this sort of questions and should be
read prior to programming like in your case. Seems you don't realize the
importance of this simplyfying procedure or maybe just don't feel it because
eventually you start feeling this very well and this leads to solving a lot
of simple problems quickly and easily even w/o much thinking of that. You
kinda start making basic operations automatically and thus you may better
concentrate on more important things, save time, etc.
I hope my comment is not just gone being ignored or completely misunderstood
and is of some help.
I hoped you can do what I'm telling about here yourself and thus I did not
provide any ready-made source code for your problem and left it up to you.
Yes, it's awesome to post here your problem and quickly get a ready-made,
working solution for no cost. But I'd recommend to work on this *basic* work
*yourself* because *you learn* from what *you* do. Your experience become
your knowledge. And when you start understanding that basic stuff you start
understanding much more.

Good Luck
P.S. sorry for some kind of unwanted lecture :)
--
Alexei A. Frounze
alexfru [AT] chat [DOT] ru
http://alexfru.chat.ru
http://members.xoom.com/alexfru/
http://welcome.to/pmode/



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019