i need some helpby emma (no login)hello to you all! i'm a new member to this forum and till today i thought i had a good knowledge of qb, but i'm stuck for good and any help from you would be highly appreciated... so here's my problem: i have created a .txt file named swap.txt, which contains the following data: name of point 1(as a string array i$()), name of point 2 (j$())and difference of elevations between the two points (as double precision number, which i call ObsDh()). the file looks like this: "swap.txt" r1 r2 25.222 r2 r4 -15.683 r2 r3 10.319 r3 r4 -26.01 r3 r1 -35.534 r4 r5 21.321 r5 r3 4.681 r5 r1 -30.855 i want to give to each point its correct elevation, starting by the constant one, which i define as con$, by adding or substracting the relevent elevation difference (ObsDh). my code is not working and i'm in despair... so please, if anybody could help me, i'd be grateful!!! so, here's my code: REM -------------------- approximate elevations calculation ----------------- CLS COLOR 10: PRINT : PRINT : PRINT "...In process of the approximate elevations calculation...":COLOR 7 PRINT : PRINT : PRINT INPUT "Please input the name of the constant point: ", con$ INPUT "... and its elevation as well! ", ConstPointElevation OPEN "d:\qb\txt\" + "swap.txt" FOR INPUT AS #10 count = 1 DO WHILE (NOT EOF(10)) LINE INPUT #10, i$(ObsNum) LINE INPUT #10, j$(ObsNum) INPUT #10, ObsDh(ObsNum) INPUT #10, Length(ObsNum) PRINT i$(ObsNum); ObsDh(ObsNum) count = count + 1 LOOP CLOSE #10 PRINT : PRINT : PRINT 'q = 1 ' DO UNTIL q = n ' wq = q + 1 ' IF i$(q) = con$ THEN ' ApEli(q) = ConstPointElevation ' ApElj(q) = ApEli(q) + ObsDh(q) ' ELSEIF j$(q) = con$ THEN ' ApElj(q) = ConstPointElevation ' ApEli(q) = ApElj(q) - ObsDh(q) ' ELSEIF j$(q) = i$(wq) THEN ' ApElj(q) = ApEli(wq) ' ApElj(wq) = ApElj(q) + ObsDh(wq) ' ELSEIF i$(q) = i$(wq) AND j$(q) <> j$(wq) THEN ' ApEli(q) = ApEli(wq) ' ApElj(wq) = ApEli(wq) + ObsDh(wq) ' ELSEIF i$(q) = j$(wq) THEN ' ApElj(wq) = ApEli(q) ' ApEli(wq) = ApElj(wq) - ObsDh(wq) ' END IF ' PRINT "H_"; : PRINT i$(wq); " "; ApEli(wq); ' PRINT " ": PRINT "H_"; : PRINT j$(wq); " "; ApElj(wq) ' PRINT "H_"; : PRINT i$(q); " "; ApEli(q); ' PRINT " ": PRINT "H_"; : PRINT j$(q); " "; ApElj(q) ' q = q + 1 ' LOOP FOR q = count TO 2 STEP -1 FOR ObsNum = q + 1 TO q + 1 IF i$(q) = con$ THEN ApEli(q) = ConstPointElevation ApElj(q) = ApEli(q) + ObsDh(q) ELSEIF j$(q) = con$ THEN ApElj(q) = ConstPointElevation ApEli(q) = ApElj(q) - ObsDh(q) ELSEIF j$(q) = i$(ObsNum) ApElj(q) = ApEli(ObsNum) ApElj(ObsNum) = ApElj(q) + ObsDh(ObsNum) ELSEIF i$(q) = i$(ObsNum) AND j$(q) <> j$(ObsNum) ApEli(q) = ApEli(ObsNum) ApElj(ObsNum) = ApEli(ObsNum) + ObsDh(ObsNum) ELSEIF i$(q) = j$(ObsNum) ApElj(ObsNum) = ApEli(q) ApEli(ObsNum) = ApElj(ObsNum) - ObsDh(ObsNum) END IF PRINT "H_"; : PRINT i$(ObsNum); " "; ApEli(ObsNum); PRINT " ": PRINT "H_"; : PRINT j$(ObsNum); " "; ApElj(ObsNum) NEXT ObsNum PRINT "H_"; : PRINT i$(q); " "; ApEli(q); PRINT " ": PRINT "H_"; : PRINT j$(q); " "; ApElj(q) NEXT q both my loops are not working... i hope i have made myself clear enough, if not forgive my english (i come from a non english speaking country) thank you in advance! |
| Response Title | Author and Date |
| First loop problem | on Nov 16 |
| help needed_part 2 | emma on Nov 17 |
| Loop Technique | on Nov 17 |
| You know what? | on Nov 17 |
| Assuming that my guess as to the problem is correct (URL*) | on Nov 18 |
| reply on you know what? | emma on Nov 19 |
| Sorry you decided not to report findings :( | on Nov 27 |
| First things first... | on Nov 16 |
| *And to think I would have posted an answer on the first loop :D | petko10 on Nov 16 |
| * LOL! I beat Ildurest by 9 minutes! | on Nov 16 |
| * And how many hundredths ? ...................timer guy | on Nov 16 |
| *Quote " danner wrote: Mac (blah blah)". TY buddy | on Nov 16 |
| help needed_part 2 | emma on Nov 17 |
| See my question (URL*) | on Nov 17 |
| OPEN... | Ralph on Nov 18 |
| Open | Valerie on Nov 18 |
| Valerie, Re:Open | Ralph on Nov 18 |
| * Eh?? What say, sonny?? | on Nov 18 |
| *Sonny? Who, me? | Ralph on Nov 18 |
| * Yep | on Nov 19 |
| * Are you stalking? LOL | on Nov 19 |
| *Is that a compliment? | Ralph on Nov 22 |