I need to write two programs and they are kicking my but.
1.) I need to write a computer program in Qbasic that will generate a Addition or Multiplication table ( which will be written to standard output). User must provide which table they want, and what rows & columns they want displayed.
2.) I also need to write a program that asks for the users FULLNAME. Use INTSTR() and MID$() to print only the middle name on the screen.
Thanks for all the helps these two have been busting my chops for the last week.
Need a little Qbasic help ( MID$ )
Re: Need a little Qbasic help ( MID$ )
Both these programs sound like a homework assignments. We are not supposed to write solutions to homework for you.darquedante wrote:.......
1.) I need to write a computer program in Qbasic that will generate a Addition or Multiplication table ( which will be written to standard output). User must provide which table they want, and what rows & columns they want displayed.
2.) I also need to write a program that asks for the users FULLNAME. Use INTSTR() and MID$() to print only the middle name on the screen.
However, If you post your attempt at programming these problems, we can offer you comments and suggestions on your code. So, take a crack at it.
On problem #1, you should first design what these tables are going to look like, and how long you want them.
On problem # 2, you should consider what you want to do if the user enters an erroneous FULLNAME, like:
* The user enters nothing or spaces(s) for FULLNAME, the program gets a null or space(s).
* Only one name, either only first or only last.
* Only first and last name, no middle name or initial.
* Etc., you need to make sure that the user enters first, middle or initial, and last name, otherwise the FULLNAME is invalid and the program won't work right. Also, do you want to program for the case when the user puts more than one space in between the name fields?
To do this program correctly will involve more code for data validation than just picking out the middle name.
*****
-
- Newbie
- Posts: 5
- Joined: Fri Mar 10, 2006 7:38 pm
Re: Need a little Qbasic help ( MID$ )
One way to handle this is to look from BOTH sides for a delilmiter between first/middle and middle/last names. The first space you come to from the left is the first delimiter and the first space you come to from the right is the second delimiter. If they're both in the same place, you don't have a middle name.moneo wrote: ...you need to make sure that the user enters first, middle or initial, and last name, otherwise the FULLNAME is invalid and the program won't work right. Also, do you want to program for the case when the user puts more than one space in between the name fields?
To do this program correctly will involve more code for data validation than just picking out the middle name.
You must have SOME restrictions on user input, so I would simply
Code: Select all
PRINT "Please enter your full name with ONE SPACE between words"
Indeed, data validation uses up more programming time than solving the initially stated problem!
--- Zim ---
--- Time flies like an arrow, but fruit flies like a banana ---
--- Time flies like an arrow, but fruit flies like a banana ---
-
- Newbie
- Posts: 5
- Joined: Fri Mar 10, 2006 7:38 pm
the wife managed to fight the progz out on her own but it took her a day on each, she is just haveing a problem seeing some of the stuff she skipped alot of class and I think she is jus not felling much of tghe groove of programming, I think the class is just not progressing, in the right way for her.. she would do better in a slower place class where they walked through everything a slower and with more one on one so they could see where she is having the troubles making connections between the proper syntax and coding to get the correct results.
thanks guys for all your help, this coming week is finals for her so we wil see how she does for her final grade.
thanks guys for all your help, this coming week is finals for her so we wil see how she does for her final grade.