AboutDon Schullian Expertise I`ve worked in BASIC since the Commodore days and maintain a web site part of which is devoted to helping others with thier problems. I`m proficient in all versions of PowerBASIC but cross over to QuickBASIC and Qbasic frequently.
Expert: Don Schullian Date: 4/1/2008 Subject: i have some qbasic questions i believe you could help me with
Question hi don, i am a student at the university of toledo engineering dept. and i am learning basic for the first time! i cant find out how to print data in columns for an assignment that involves printing a conversion table for kilograms and pounds. also i have an up coming assignment which is as follows:
1.Write a QBASIC program that requests a word from the user which contains the letters "r" and "n" as input and determines which of these two letters appears first. If the word does not contain both of the letters, the program should keep requesting until an input word does. (Test the program with the words colonel and merriment.)
2.Write a program that asks the user to enter positive numbers until the product of all numbers entered exceeds 400. Once the product does exceed 400, the program should display the largest number entered, the number of numbers entered, and the product of the numbers. The program should not accept negative numbers or zero.
this is an online class and there is no one to help me! my discipline is biomedical so i dont know anything about programming! if you could please give me some pointers that would be highly appricated (you dont know how much!)
thank you very much for your time don!
matt
Answer Hi Matt,
1st of all to get things in columns you'll want to use the comma after the PRINT USING statment. (Would you believe that, right now I can't remember how to use PRINT USING in QBASIC!) I think it goes something like this:
FOR V% = 1 TO Last%
PRINT USING "###.##"; Var(V%)!,
IF (V% MOD 3) = 0 THEN PRINT ' This get the cursor to next line
NEXT
-----------------
For the letter search you'll need to use INSTR for both letters then determine which was first by comparing the results.
-----------------
To get the highest number is fairly easy. The part you're supposed to be learning here (I guess) is the GOTO statement. Its use will allow you to keep looping through the input statements and making caparisons.
-----------------
Matt, we don't do homework around here but we don't mind helping out. If you want me to look over your code or get stuck send me some code to play with so I can tell you're making an honest attempt. Coding isn't difficult but requires a particular mind set that doesn't, at times, come easy to everyone.