• Baja Class 100.2

    From Finnigann@VERT/BNB to Pistolgrip on Tue Oct 23 10:09:00 2001
    So with all these varibles etc. How do you determine what's doing what?ãFile names and so forth?ããIs the algorithm part? Pencil and Paper part... This one of the firstãsteps and where I bog down.ããDetermining where to start, or what must happen first, second,ãthird...etcããI guess after it is determined what you must do to get from the firstãstep to the last step, then you can figure out what files and names toãuse.ããIs this something that can be taught?ããI imagine an experienced programmer has basic steps that they use inãwhatever program they are writing. And steps they include when... sayãthey open a file they might check to see if one exists first (justãguessingh here). They might also include error trapping routines soãthat when the inevitble errors do crop up, they will at least leave aãtrace.ããAlright lets design something simple; open, read, and depending on whatãis in the opened file, write a NEW file. Be it a score file or a recordãof events, doesn't matter, the steps taken in the order they are takenãwill show alot on how to solve a problem and deal with it.ãããAlthough this is addressed to Pistolgrip, let anyone jump in at anyãtime.ããã... Heisenberg may have slept here.ã--- MultiMail/MS-DOS v0.40ã þ Synchronet þ Bits-N-Bytes BBS - One Hellova BBS -- telnet://bnb.dtdns.netã
  • From Amcleod@VERT to Finnigann on Tue Oct 23 11:17:52 2001
    RE: Baja Class 100.2ãBY: Finnigann to Pistolgrip on Tue Oct 23 2001 05:09 pmãã > Is the algorithm part? Pencil and Paper part... This one of the firstã > steps and where I bog down.ã > ã > Determining where to start, or what must happen first, second,ã > third...etcã > ã > I guess after it is determined what you must do to get from the firstã > step to the last step, then you can figure out what files and names toã > use.ããThis is all part of the program-design, which can be done entirely byãnon-programers if needed. There are many different techniques, and theirãmerits are the subject of near-religeous argument.ããOne very common method of designing your program is FLOWCHARTING. Yes,ãflowcharts are completely passe these days -- back in 1975 I was taught not toãuse it. But for the beginner, it can be a very simple method of visualizingãthe program algorythm. I personally like to use an informal data-flow diagramãtechnique wherein I graphically depict where the data comes from, where it isãstored, where it goes to, and how it is manipulated along the way. In actualãfact, when you have experience, you automatically select the design method thatãyour experience tells you most suited to the current problem-at-hand.ãã > Is this something that can be taught?ããThere are classes and text-books available on the subject of system design. ãAny introductory work on programming will attempt to give you the gist. ãã > I imagine an experienced programmer has basic steps that they use inã > whatever program they are writing. And steps they include when... sayã > they open a file they might check to see if one exists firstããSure. Again, experience will tell you what fragments work best. Let's say youãare opening a file. You could doãã hnd = fopen( "filename.text", "r" );ããbut suppose the file didn't open for whatever reason? So maybe you just makeãa habit of doingãã if (!(hnd=fopen(""filename.text","r"))) {ã puts(strerror(errno));ã exit(1);ã }ããevery time instead. Each programmer will develop his own style.ãã > Alright lets design something simple; open, read, and depending on whatã > is in the opened file, write a NEW file.ããOkay, let me set YOU an exercise. To develop a BAJA program to do theãfollowing:ãã 1) Open a disk file called INPUT.DAT for reading, halt with an errorã message if the file is not found or for some reason won't open.ã 2) Open a disk file called OUTPUT.DAT for writing, creating the fileã if it doesn't exist, truncate it if it does exist. If it can't beã opened/created, a) close the input file opened in step 1, b) printã an error message, c) halt.ã 3) Read one line at a time from the input file, for processing.ã 4) Process each line as follows:ã 4a) If the line is a comment (starts with "#") ignore it.ã 4b) If it is NOT a comment, convert it to UPPER CASEã 5) Write each line to the output file.ã 6) When all input data has been processed, close input & output files.ããThere you go. A simple program, broken down into six simple parts. Work onãeach part and show us what you come up with. Obvious place to start is withãthe BAJA documentation and the command for opening a file. You are talkingãboth INput and OUTput files. This will cover steps 1 and 2. While doing thisãyou may as well check out how to CLOSE files, possibly needed in step 2 andãdefinately in step 6. ããGet going!ãã:)ã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From Finnigann@VERT/BNB to Amcleod on Tue Oct 23 14:42:00 2001
    Amcleod wrote to Finnigann <=-ãããã Am> Get going!ããOy vey! Homework... okãããã Am> :)ããWould an apple here be out of place?ãã Am> ---ã Am> þ Synchronet þ Vertrauen þ Home of Synchronet þã Am> telnet://vert.synchro.netãã... "Cha-CHING!!! YES! YES! YES!" {EG} ã--- MultiMail/MS-DOS v0.40ã þ Synchronet þ Bits-N-Bytes BBS - One Hellova BBS -- telnet://bnb.dtdns.netã