Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Can somebody PLEASE help me!

Author
Message
Geoff123
16
Years of Service
User Offline
Joined: 22nd Dec 2007
Location:
Posted: 24th Dec 2007 15:32
Hi i am new to programming and really need some advice.. if i have the following code DIM cities(6) AS STRING DIM population(6) AS INTEGER Then a list of 6 cities with populations in a DATA statement eg: "LONDON", 250,000 etc., followed by a FOR and READ loop, how would i allow for a user to input 2 numbers in the cities listed and then display the combined population of both? Any help is massively appreciated. I do own the book (vol 1) by Alistair Stewart but i am struggling a bit getting to grips with arrays. Thanks again.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 24th Dec 2007 21:16 Edited at: 24th Dec 2007 22:04
the following code works using 2 1-dimensional arrays, as requested:



note how the 2 arrays are DIMed (a little different from how you were going about it) and how the 2 arrays are filled by reading 2 data statements per loop. ie, how they coincide with eachother.

good luck!

edit: ACK! it worked before i pasted it. will be back with working code ASAP.
edit2: <shrugs> now it's working. i musta pasted it wrong

Virtual Nomad
AMD XP 1800+ (~1.6 Ghz) / 1.5 GB RAM
ATI Radeon 8700LE 128 MB / Windows XP
Geoff123
16
Years of Service
User Offline
Joined: 22nd Dec 2007
Location:
Posted: 25th Dec 2007 09:43
Virtual Nomad thats superb, thanks for taking the time to help.

Login to post a reply

Server time is: 2024-11-26 05:25:22
Your offset time is: 2024-11-26 05:25:22