Board index » delphi » HELP:an algorithm is getting on my nerves...
eu
![]() Delphi Developer |
Wed, 03 Oct 2001 03:00:00 GMT
|
eu
![]() Delphi Developer |
Wed, 03 Oct 2001 03:00:00 GMT
HELP:an algorithm is getting on my nerves...
Hello everyone.
I'm kinf of a newbie with pascal. I was reading a book the other day and one of the exercises they sugested was writing an algorithm that selects the heaviest student in a class. Perhaps I'm facing a mental block but I can't figure it out. Can anyone help me on this one??Pleeeeeease..... Pls reply by mail to |
eu
![]() Delphi Developer |
Wed, 03 Oct 2001 03:00:00 GMT
Re:HELP:an algorithm is getting on my nerves...Hello everyone. I'm kinf of a newbie with pascal. I was reading a book the other day and one of the exercises they sugested was writing an algorithm that selects the heaviest student in a class. Perhaps I'm facing a mental block but I can't figure it out. Can anyone help me on this one??Pleeeeeease..... Pls reply by mail , too. sincerely |
McFly!!!!!
![]() Delphi Developer |
Wed, 03 Oct 2001 03:00:00 GMT
Re:HELP:an algorithm is getting on my nerves...Quoteeu wrote: you not to think I haven't done my homework here's the catch. 1- suppose i have three students in my class would the following program work. If it would, then why doesn't it?:) program pesos; BEGIN 2) what if my class has n students , i.e. i dono the number os students once again thanx for any help you've got! |
Ken Robbin
![]() Delphi Developer |
Wed, 03 Oct 2001 03:00:00 GMT
Re:HELP:an algorithm is getting on my nerves...Try posting your code, so we will be able to tell you what you are doing wrong. -- "If everything seems to be going well, you have obviously overlooked Quoteeu wrote: |
Rabad
![]() Delphi Developer |
Thu, 04 Oct 2001 03:00:00 GMT
Re:HELP:an algorithm is getting on my nerves...Well, what you could do is at the beginning have it ask for the # of students, and then a readln(num), and then some code like this: temp :=0 Well, that might help you. Noah Quote>eu wrote: |
Derek T. Asa
![]() Delphi Developer |
Thu, 04 Oct 2001 03:00:00 GMT
Re:HELP:an algorithm is getting on my nerves...Quote"McFly!!!!!!" <np2...@mail.telepac.pt> writes: If you're asking why your source code won't compile, the answer is an incorrect IF-THEN syntax. If the question deals with incorrect results, no meaningful comments are possible without knowing what those results are and what they were expected to be. Saying that you can't figure out an algorithm and then providing Assuming each student's weight is different from all other 1. Place the students in a single line Now all you have to do is implement the algorithm in the computer |
Bob Scho
![]() Delphi Developer |
Thu, 04 Oct 2001 03:00:00 GMT
Re:HELP:an algorithm is getting on my nerves...QuoteMcFly!!!!!! wrote: for IF is IF <logical test> THEN <statement> The lines you have above do NOT follow this syntax. For example, IF (B > A) AND <ifstatement> where <ifstatement> is "if (A>C) then writeln ('the heaviest is A')". Quote
help. Suppose I ask you to tell me the weight of the heaviest student in your class, or even in your school. How would you do it, assuming you could ask each student his/her weight? One way would be to write down all of the weights (which is the solution method you've chosen), in which case you need to store an unspecified number of variables. However, if all I want is the weight of the heaviest, I don't need to store any weights (except the heaviest!), nor do I need to know how many students I'll have (except to know it is > 0, i.e. at least 1). Can you see how to do it? Try asking "Amy, how much do you weight? Betty, how much do you weight? Charlie, how much do you weight?" and, without having to remember all three weights, come up with the heaviest. [I dare say, if you actually ask those questions, you are likely to get your face slapped ...]. Bob Schor |
walt..
![]() Delphi Developer |
Fri, 05 Oct 2001 03:00:00 GMT
Re:HELP:an algorithm is getting on my nerves...In article <371A0D26.7C07F...@vms.cis.pitt.edu>, Bob Schor <bsc...@vms.cis.pitt.edu> wrote: [snip] Quote> Well, here again is where doing the experiment "in your head" would But you're right. If all that is needed is the one weight and name, why store all the others? ---------- WARNING: Anti-spam fanatic. Keep your ads to yourself!!! -----------== Posted via Deja News, The Discussion Network ==---------- |
McFly!!!!!
![]() Delphi Developer |
Sat, 06 Oct 2001 03:00:00 GMT
Re:HELP:an algorithm is getting on my nerves...Guys....you can't believe how much you helped me. This is a very simple problem (know that I know the solution:)) Thank you very much. But I have the feeling it won't be the last time you'll hear (read would be more appropriated) from me :)) P.P. |
1. Indy OnStatus AV getting in my nerves.
2. Help in Algorithm i wrote for Getting Partial Bitmap
3. Why am I not getting the RTE 200?
4. Why am I getting an EDBEngineError?
5. Why am I getting an Address violation
6. Why am I getting this error?
7. Why i am getting De{*word*81} error
8. I am getting followin Exceptions
9. I am getting followin Exceptions with INDY (8.1.0 - Test Installation)