View Full Version : BASIC Programming question
Li'l Dave
10-31-2005, 12:04 PM
I have to write a program in BASIC that displays my address 4 times with a blank line in between each one using a counter controlled loop. I can get it to write my adress once, but I have no idea how to make it loop 4 times. Any info would be great, I'm really lost. Thanks.
Toshi
10-31-2005, 12:36 PM
post up what you have so far, including your loop
sanjuro
10-31-2005, 04:13 PM
10 SIN
20 GOTO HELL
I saw that in a Futurama episode...
Ridemonkey
10-31-2005, 05:38 PM
10 PRINT "Your address"
20 NEXT I
30 IF I < 4 GOTO 10
40 END
I'm rusty, but that should work.
Tenchiro
10-31-2005, 05:49 PM
If I was still in middle school I could tell you, but the sands of time has long sice eradicated that knowledge.
Li'l Dave
10-31-2005, 10:24 PM
Well first of all I cant even write the loop at all, I have no idea how to do it. For some reason Ridemonkey, the program wont let yours work, I really don't know why. Another thing, how do I write out my address in 3 lines anyhow? Sorry for the dumb questoins, I just need to get past this stuff to go on.
sanjuro
11-01-2005, 03:17 AM
Well first of all I cant even write the loop at all, I have no idea how to do it. For some reason Ridemonkey, the program wont let yours work, I really don't know why. Another thing, how do I write out my address in 3 lines anyhow? Sorry for the dumb questoins, I just need to get past this stuff to go on.
I hope you aren't planning a long career in computers. I am interviewing for a new job, so it is study study study for me.
10 FOR I = 1 TO 4
20 PRINT "ADDRESS"
30 PRINT "CITY STATE ZIP"
40 NEXT I
I was also reading in the wiki page about "Modern" Basic http://en.wikipedia.org/wiki/Basic_programming_language, and this would be the code then:
FOR I = 1 TO 4
PRINT "ADDRESS"
PRINT "CITY STATE ZIP"
NEXT I
MMike
11-01-2005, 11:29 AM
10 FOR I = 1 TO 4
20 PRINT "ADDRESS"
25 PRINT
30 PRINT "CITY STATE ZIP"
40 NEXT I
Don't you need that extra blank line in there?
They are still teaching this stuff? This is SO 1982
Li'l Dave
11-01-2005, 01:24 PM
Yeah, I can't believe that they are still teaching BASIC. What do you mean Sanjuro that you hope I am not planning on a long carreer in computers? I'm actualy training to be a mechanical engineer.
sanjuro
11-01-2005, 02:23 PM
Yeah, I can't believe that they are still teaching BASIC. What do you mean Sanjuro that you hope I am not planning on a long carreer in computers? I'm actualy training to be a mechanical engineer.
I haven't used BASIC in 20 years, but I was able to look it up on Wikipedia and after reading the entry for 5 minutes, able to produce code.
This wasn't a question like "What is the difference between Call by Value vs Call by Name?", but it was like, "I don't know how to write a loop so someone else write it for me".
Keep in mind that 99% of the education I have received from computer science was me looking it up and figuring it out.
If you didn't understand how a "FOR" loop worked, or why "NEXT I" incremented a counter, you should have asked.
amydalayna
11-01-2005, 02:33 PM
I too am really suprised they are still teaching BASIC.
whenever I have something I'm trying to program and I can't figure out how I use google groups.
http://www.google.com/grphp?hl=en&tab=wg&q=
it's one of the best resources.
sanjuro
11-01-2005, 03:09 PM
I too am really suprised they are still teaching BASIC.
whenever I have something I'm trying to program and I can't figure out how I use google groups.
http://www.google.com/grphp?hl=en&tab=wg&q=
it's one of the best resources.
I think it is an useless language, and not a particularily good one for teaching.
I suppose the linear execution is similar to assembly language, but it is easy enough to pick up the logic.
amydalayna
11-01-2005, 03:12 PM
I think it is an useless language, and not a particularily good one for teaching.
I suppose the linear execution is similar to assembly language, but it is easy enough to pick up the logic.
I agree with your point on it not being a good language for teaching. I learned with VB6 and I think that's a good language to start with.
Li'l Dave
11-01-2005, 04:44 PM
I get your point, but this is my first semester even seeing this stuff. We have been doing BASIC for about 2 weeks, and my notes are not really giving me everything that I need. Also, I don't know a good place to try and find the answer that I was looking for, everything that I tried just brought me to a dead end. Sometimes you need to get some specific help from someone to be able to get past something small so you can get to more complex questions.
Kornphlake
11-01-2005, 05:34 PM
If you're studying mech eng you'll likely look at labview at some point. I feel like it's the easiest programming language for mechie guys to use because everything is laid out as if it were a mechanical object for the most part. Still the loops never seem to work for me the way I imagine.
Good luck with the programming thing, thankfully unless you're wierd you'll only spend a small portion of your career writting code.
Li'l Dave
11-01-2005, 07:35 PM
That's what I wanted to hear, programming is borring. Hopefully I wont need to spend hardly any time at all doing it. This is for a basic computer science class, its the first set of problems that we have to do.
amydalayna
11-01-2005, 07:44 PM
That's what I wanted to hear, programming is borring. Hopefully I wont need to spend hardly any time at all doing it. This is for a basic computer science class, its the first set of problems that we have to do.
i will say this:
programming is not always boring. solving problems can be satisfying.
the reason to stay away from programming is not the work. it's the people. bunches of dorks.
except for me that is.
sanjuro
11-01-2005, 10:39 PM
i will say this:
programming is not always boring. solving problems can be satisfying.
the reason to stay away from programming is not the work. it's the people. bunches of dorks.
except for me that is.
Dork.
sanjuro
11-01-2005, 10:40 PM
That's what I wanted to hear, programming is borring. Hopefully I wont need to spend hardly any time at all doing it. This is for a basic computer science class, its the first set of problems that we have to do.
Good luck with Fortran...
Li'l Dave
11-01-2005, 11:59 PM
I guess your right, programming isn't always borring. I've been in front of my computer all day trying to get these problems done. And I don't know what you are trying to get at Sanjuro, I just asked a question and you're giving me grief for not knowing as much as you. Thanks but no thanks.
sanjuro
11-02-2005, 03:30 AM
I guess your right, programming isn't always borring. I've been in front of my computer all day trying to get these problems done. And I don't know what you are trying to get at Sanjuro, I just asked a question and you're giving me grief for not knowing as much as you. Thanks but no thanks.
1. I gave you the answer, and I believe the correct one.
2. I might be giving you a hard time, but I had the same problems you are having when I first learned how to code. No one gave me the answer straight out, but my teachers taught me how to think it out for myself.
If you are having a problem with basic programming concepts, you should ask that. It seemed liked you wanted just the answer, which doesn't teach you very much.
I am sorry if I seem like a jerk (which I am), but understanding loop structures is critical if you want to use programming languages, like Fortran, C, or Java, which are all used in engineering.
BTW, the question I would ask is how does FOR loop work.
Li'l Dave
11-02-2005, 03:47 AM
And thank you for the answer, but I don't like being treated like and idiot. And I know just getting the answer doesn't teach me anything, I just wanted to get past the first stupid part so I could go on.
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.