![]() |
QBasic
3 Attachment(s)
I figured QBasic isnt the same of Visual Basic or .net, so, posting here.
I am trying to learn it via online tutorials. Not the best method of approach I realize, however, it is my only means at the time. Anyway, I've gotten to chapter 3 of the tutorial, and am having a bit of trouble with the "homework". It is as follows: Your homework is as follows. Using an array, ask the user for input 5 times (you can use a FOR...NEXT LOOP!) and assign each number they input to an element in the array... then ... create a file and put the five numbers into that file. Make sure to erase the numbers from the last time you ran the program! This is all good and well, but this was never explained in the tutorial. I understand how to use the FOR...NEXT loop, but not whilst using an array. My best attempt, simply gave me a text file with five 0's. :
CLSNow, this may appear to be glaringing obvious to you guys, but please bear in mind, I have no programming experience whatsoever outside of HTML, and I really wouldn't even consider that programming. Reading over the tutorial, it would appear that this would be the correct way to achieve the correct end result. In fact, I'll go ahead and put the tutorial on here for you guys to look over if you feel the need. Thanks. |
Its been a while since I did any basic, but just to point you in the right direction:
:
FOR Numbers(5) = 1 TO 5Line 3 - You want to input into a particular item in Numbers, so use the array access Numbers(n). So something like: :
FOR n = 1 TO 5Similarly you can use a for loop for the output. |
~Added code tags
|
go here for qbasic help http://forum.qbasicnews.com/
im supprised you didnt find that place alread. |
well, it's a far cry from vb or .net in many respects, but the coding is similar on some levels (like this particular one).
any reason you picked QBASIC? |
Folks, you're doing this guy's homework! It's not like he was even stealthy about it...
Quote:
|
Quote:
2. He showed that he was trying to do the work. All I did was point out some syntax errors in his code. 3. Four lines of code and some explanation does not constitute "doing this guys homework". Are you trying to say we should just ignore all questions about homework? I thought that was the one of the reasons for this forum, people get stuck on a coding problem after giving it a try, then ask for help. |
Quote:
Once I get QBasic down, it will be easier to transition to a more advanced language. |
Quote:
|
The Dark and m0rb1d: OK, my bad, please accept my apologies. I need to read a bit more carefully before I start mouthing off in future.
I started out with a simple old BASIC too - I first programmed on ORIC Micros in a variant of Microsoft BASIC back in the days of mandatory line numbers and no named procedures and went through BBC Basic (named procedures; wow!), RM BASIC and QBASIC before I finally made it into C. While I can't deny programming in BASIC was plenty of fun, I would generally recommend starting with a simple but /good/ language (like Pascal or C); starting in BASIC can make it more difficult to shift to the real world later on. I think all dialects of BASIC are in the process of fading out now (VB.NET is a bit of a last gasp I suspect and I've yet to find anyone who actually uses it - most of the VB6 programmers I know are making the move to C# rather than VB.NET). Still, if you've started you may as well continue; just don't get stuck in BASIC for too long. It teaches bad practices and leads to unhelpful expectations. Good luck and have a lot of fun with it though. And don't let miserable old farts in forums who don't read your questions properly and jump to conclusions bother you ... heh. |
| All times are GMT -5. The time now is 1:18 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC