Need a little Qbasic help ( MID$ )

Discuss whatever you want here--both QB and non-QB related. Anything from the DEF INT command to the meaning of life!

Moderators: Pete, Mods

Post Reply
darquedante
Newbie
Posts: 5
Joined: Fri Mar 10, 2006 7:38 pm

Need a little Qbasic help ( MID$ )

Post by darquedante »

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.
moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Re: Need a little Qbasic help ( MID$ )

Post by moneo »

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.
Both these programs sound like a homework assignments. We are not supposed to write solutions to homework for you.

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.
*****
darquedante
Newbie
Posts: 5
Joined: Fri Mar 10, 2006 7:38 pm

Post by darquedante »

okay I'm gonna have to have the wife post that cause I'm just trying to help her, she is stuck and my QB is rusty... been a couple days since C64 came out guys :)
User avatar
Zim
Veteran
Posts: 98
Joined: Mon Dec 05, 2005 4:31 pm
Location: Wisconsin, USA
Contact:

Re: Need a little Qbasic help ( MID$ )

Post by Zim »

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.
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.

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"
or something to that effect, then check for the presence of THREE words, and cycle back if the user didn't enter three separate 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 ---
darquedante
Newbie
Posts: 5
Joined: Fri Mar 10, 2006 7:38 pm

Post by darquedante »

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.
Post Reply