Page 1 of 1

And it still worked earlier

Posted: Tue Sep 09, 2003 10:54 am
by Kon-Tiki
Damn program! Didn't do anything to the part where it asks the target's longitude, but it keeps on looping nonetheless, while, before I finished the convert-function, it worked without a problem.

What's even weirder, is that it should store the inserted value in a struct. Declared two vars from that type. The first one works with exactly the same code (but with home. instead of target. off course)

I'll include the source (as .txt, since I can't upload .cpp)for those who like a good brain teaser. I'm completely befuzzled about this one, since everything looks ok to me (and it worked earlier without a problem and didn't do any fiddling on it)

[attachment deleted by admin]

Re:And it still worked earlier

Posted: Tue Sep 09, 2003 1:38 pm
by BI lazy
have compiled it on my linux box and it executes without any looping.

although, the final hour it spills out, is a bit insane *g*- here is the test run

Code: Select all

Enter your longitude: 120
(E)ast or (W)est: (E)ast or (W)est: E
Enter target's longitude: 130
(E)ast or (W)est: (E)ast or (W)est: W
What hour is it (in 24, NOT am/pm)? 23
It is now 134514256 o'clock at the target's place.

hope this helps

Re:And it still worked earlier

Posted: Tue Sep 09, 2003 2:08 pm
by Kon-Tiki
Probably some morphing from one var type to the other. Still need to fiddle with that (and make the wrap at 24h), but wanted to test it, and it loops and keeps on looping at the target's longitude. Seems like there's no problem though, but it should work fine here too then.

Edit: attached a screenshot of what it does here. Credits to Allen for making the bmp smaller than 10kb, curses to Ms Paint for not being able to do so... and curses to me for not checking that gifs are not allowed and it's 30kb instead of 10 ::)

[attachment deleted by admin]

Re:And it still worked earlier

Posted: Wed Sep 10, 2003 6:08 am
by Kon-Tiki
It works now. Nick has found the problem. Seems like a double shouldn't be represented by %f, but by %fl. Now to continue work... re-checking the calculations (some're wrong with certain values)

Re:And it still worked earlier

Posted: Wed Sep 10, 2003 5:08 pm
by sonneveld
er... "%lf".. the 'l' modifies the 'f' to be a double. Same goes for printing doubles as well :)

- Nick

Re:And it still worked earlier

Posted: Thu Sep 11, 2003 12:50 am
by Kon-Tiki
Woops. %fl %lf... what's the difference ;D
Anyway, it works now. Time for phase 2: adding a database to it and giving the program a menu so you can either access the database-management or the calculating part.