Structured Programming - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: General (http://qbasicnews.com/newforum/forum-6.html) +--- Forum: General/Misc (http://qbasicnews.com/newforum/forum-18.html) +--- Thread: Structured Programming (/thread-8503.html) |
Structured Programming - GordonSweet - 12-28-2005 It has been kindly pointed out to me that Liberty Basic does have an alternative to the PROCedures used in BBC BASIC (for Windows) needed for true Structured Programming as below. I wonder how the experts on programming view the LB way Gordon 'copy two files into one fileOne$ = "first.txt" fileTwo$ = "second.txt" combined$ = "together.txt" call mergeFiles fileOne$, fileTwo$, combined$ end sub mergeFiles firstFile$, secondFile$, merged$ open merged$ for output as #merged open firstFile$ for input as #first print #merged, input$(#first, lof(#first)); close #first open secondFile$ for input as #second print #merged, input$(#second, lof(#second)); close #second close #merged end sub Structured Programming - Moneo - 01-01-2006 Quote:It has been kindly pointed out to me that Liberty Basic does have an alternative to the PROCedures used in BBC BASIC (for Windows) needed for true Structured Programming as below. I wonder how the experts on programming view the LB wayLooks fairly straightforward. However, you should be careful with your usage of the terms COPY and MERGE. COPY can be a simple file copy or it can be a concatenation of one or more files, which is what you are doing above. On the other hand, a MERGE implies merging individual records of each file by some key, which is not what you are doing in your sub mergeFiles. A word of warning: Copying or concatenating files can be dangerous when you do this from within a program which may interpret end-of-record characters, end-of-file characters, and some special characters differently than MSDOS. The recommended way is to SHELL to the required copy command. Believe me, I found this out the hard way. ***** Structured Programming - Blitz - 01-20-2006 Structured programming is just common sense. But unfortuneatly not many qbers seems to have that common sense from the code i've seen. And to who ever said assembly is just random code or whatever. You are missinformed. It's no more or less random or structured then say qb for instance. There's more structure in this peice of assembly code then i've seen in most programs written in qb. http://ratatoskr.dragonhill.cc/forum/viewtopic.php?t=34&start=11 |