Please Help /w QBasic Prog. 4 Dummies 
Author Message
 Please Help /w QBasic Prog. 4 Dummies

Hello,
I am trying to learn basic programming with QBasic Programming for
Dummies a my first (well not really but..the other's were too old and
to difficult to read) text book on the subject.  This book has sample
programs (code..what ever..) that your suposed to type in and run as
practice problems but the following code won't run it gives me an
argument-count mismatch error(What ever that is.) Please help me get
over this hump if you can.  Let me know if it's me or the author who
screwed this code up?

Thanks,

-and walk good!!!!

THE CODE-

' Travel Expense Log (EXPLOG.BAS)
' Records expenses during
' a business trip

DECLARE SUB GetExpenseRec ()
DECLARE FUNCTION YesOrNo$ (question$)

' Open expense log file.
OPEN "\EXPLOG.TXT" FOR APPEND AS #1
' Read expense records from keyboard
DO
 GetExpenseRec
LOOP UNTIL YesOrNo$("Input Another expense?  ") = "N"

END  ' EXPLOG.BAS

SUB GetExpenseRec
 ' Reads one expense record from the keyboard
CLS
PRINT "Expense Log"
PRINT "------- ---"
PRINT
' Accept the user's date input or
' supply today's date as the default.
INPUT ; "Date (Enter for today): ", expDate$
IF LTRIM$(expDate$) = "" THEN
  PRINT DATE$
  expDate$ = DATE$
ELSE
  PRINT
END IF

' Get the remaining fields.
LINE INPUT "location:      "; city$
LINE INPUT "Description:   "; descript$
INPUT "Amount spent:  ", amount
INPUT "Exchange rate: ", rate

'Save the record to the expense file.
PRINT
IF YesOrNo("Do you want to save this record? ") = "Y" THEN
  WRITE #1, expDate$, city$, decript$, amount, rate
END IF

END SUB ' GetExpenseRec

FUNCTION YesOrNo$

 ' Display a question and wait
 ' for the user to type Y or N.

PRINT questions$;
DO
 answers$ = UCASE$(INKEY$)
LOOP UNTIL answers$ = "Y" OR answers$ = "N"
PRINT answers$

YesOrNo$ = answers$

END FUNCTION  ' YesOrNo$



Mon, 08 Mar 1999 03:00:00 GMT  
 Please Help /w QBasic Prog. 4 Dummies


Quote:

>Hello,
>I am trying to learn basic programming with QBasic Programming for
>Dummies a my first (well not really but..the other's were too old and
>to difficult to read) text book on the subject.  This book has sample
>programs (code..what ever..) that your suposed to type in and run as
>practice problems but the following code won't run it gives me an
>argument-count mismatch error(What ever that is.) Please help me get
>over this hump if you can.  Let me know if it's me or the author who
>screwed this code up?

>Thanks,

>-and walk good!!!!

>THE CODE-

Check out your FUNCTION that reads....

FUNCTION YesOrNo$

it should read...

FUNCTION YesOrNo$ (questions$)

Beau Schwabe



Tue, 09 Mar 1999 03:00:00 GMT  
 Please Help /w QBasic Prog. 4 Dummies

Quote:

>Hello,
>I am trying to learn basic programming with QBasic Programming for
>Dummies a my first (well not really but..the other's were too old and
>to difficult to read) text book on the subject.  This book has sample
>programs (code..what ever..) that your suposed to type in and run as
>practice problems but the following code won't run it gives me an
>argument-count mismatch error(What ever that is.) Please help me get
>over this hump if you can.  Let me know if it's me or the author who
>screwed this code up?

 First, I suggest Using Basic 2nd OR Special edition from Que publishing.
 QBASIC by Example also comes highly recommended from Que.
 QB 4 Dummies is awful. Their DOs for dummies books are good, but
 when it comes to programming, leave them as the dummies they are.

Quote:
>DECLARE SUB GetExpenseRec ()
>DECLARE FUNCTION YesOrNo$ (question$)

 [Main program appears OK]

Quote:
>SUB GetExpenseRec
>INPUT ; "Date (Enter for today): ", expDate$

 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 ERROR: Try removing the first semi-colon right after INPUT.
Quote:
>FUNCTION YesOrNo$



Tue, 09 Mar 1999 03:00:00 GMT  
 Please Help /w QBasic Prog. 4 Dummies

Hello,
I am trying to learn basic programming with QBasic Programming for
Dummies my first (well not really but...the other's were too old and
to difficult to read) text book on the subject.  This book has sample
programs (code..what ever..) that your suposed to type in and run as
practice problems but the following code won't run it gives me an
argument-count mismatch error(What ever that is.) Please help me get
over this hump if you can.  Let me know if it's me or the author who
screwed this code up?

Thanks,

-and walk good!!!!

THE CODE-

' Travel Expense Log (EXPLOG.BAS)
' Records expenses during
' a business trip

DECLARE SUB GetExpenseRec ()
DECLARE FUNCTION YesOrNo$ (question$)

' Open expense log file.
OPEN "\EXPLOG.TXT" FOR APPEND AS #1
' Read expense records from keyboard
DO
 GetExpenseRec
LOOP UNTIL YesOrNo$("Input Another expense?  ") = "N"

END  ' EXPLOG.BAS

SUB GetExpenseRec
 ' Reads one expense record from the keyboard
CLS
PRINT "Expense Log"
PRINT "------- ---"
PRINT
' Accept the user's date input or
' supply today's date as the default.
INPUT ; "Date (Enter for today): ", expDate$
IF LTRIM$(expDate$) = "" THEN
  PRINT DATE$
  expDate$ = DATE$
ELSE
  PRINT
END IF

' Get the remaining fields.
LINE INPUT "location:      "; city$
LINE INPUT "Description:   "; descript$
INPUT "Amount spent:  ", amount
INPUT "Exchange rate: ", rate

'Save the record to the expense file.
PRINT
IF YesOrNo("Do you want to save this record? ") = "Y" THEN
  WRITE #1, expDate$, city$, decript$, amount, rate
END IF

END SUB ' GetExpenseRec

FUNCTION YesOrNo$

 ' Display a question and wait
 ' for the user to type Y or N.

PRINT questions$;
DO
 answers$ = UCASE$(INKEY$)
LOOP UNTIL answers$ = "Y" OR answers$ = "N"
PRINT answers$

YesOrNo$ = answers$

END FUNCTION  ' YesOrNo$



Wed, 10 Mar 1999 03:00:00 GMT  
 Please Help /w QBasic Prog. 4 Dummies

Quote:

>Hello,
>I am trying to learn basic programming with QBasic Programming for
>Dummies a my first (well not really but..the other's were too old and
>to difficult to read) text book on the subject.  This book has sample
>programs (code..what ever..) that your suposed to type in and run as
>practice problems but the following code won't run it gives me an
>argument-count mismatch error(What ever that is.) Please help me get
>over this hump if you can.  Let me know if it's me or the author who
>screwed this code up?

<snip>

You didn't mention "where" the error was popping up but here's one..
FUNCTION YesOrNo$ ( Question$ )

Quote:
>FUNCTION YesOrNo$

And... while I'm at it!

(scraping sounds of the soapbox being drug out from under the desk)
(sounds of creaking wood as I step up)

  Code like this has appeared in books on BASIC ever since the
Commodore days and I firmly believe that it retards the learning
process! It seems that, in an effort to "get published" and/or "keep
it simple" and/or "provide instant, visual results" it skips over most
of the very basic concepts that are, IMHO, vital to programming, in
ANY language.

  What lit my fuse (this time) was the use of INPUT and, more
importantly, the way it was used! First of all, to use INPUT to gather
info from the user is, at best, bad. If you're going to use it to
input numeric values, first input strings then convert to a numeric
value. Is this so difficult a concept that people can't understand it?

  INPUT "Enter a number: ", N$
  N! = VAL( N$ )

  What, however, needs to be done, up front, is to create a small but
efficient field editor. A simple task that takes but a few lines of
simple, easy to understand code. This would teach newbies the
importance of creating re-usable functions while providing a good
foundation for future programming.

  By the time one has progressed to the point where this style
program/demo is required (s)he should already be versed in at least
two functions: fGetKey$ (to gather individual key-presses ) and
fInput$ (to gather field data). I can't imagine programming without
either and have written similar items for at least 4 languages. In
fact the _ONLY_ language that these were not the first functions
written was Commodore BASIC and that is where I learned them.

  Sorry for ramblin' on like this but...... Well, anyhow thanks for
{*filter*} in there.



Wed, 10 Mar 1999 03:00:00 GMT  
 Please Help /w QBasic Prog. 4 Dummies

: Hello,
: I am trying to learn basic programming with QBasic Programming for
: Dummies a my first (well not really but..the other's were too old and
: to difficult to read) text book on the subject.  This book has sample
: programs (code..what ever..) that your suposed to type in and run as
: practice problems but the following code won't run it gives me an
: argument-count mismatch error(What ever that is.) Please help me get
: over this hump if you can.  Let me know if it's me or the author who
: screwed this code up?
:
: Thanks,
: -and walk good!!!!
:

This is the error !

FUNCTION YesOrNo$

and this is correct mode:

FUNCTION YesOrNo$ (question$)

question$ is the missing parameter

ciao ciao

--
Roberto Marchini



Wed, 10 Mar 1999 03:00:00 GMT  
 Please Help /w QBasic Prog. 4 Dummies

Thank you all for your prompt helpful replies.  The code now runs as
it should. (I made mistakes in it everywhere!!)

Don I appreciate your concerns! I would like to know which is the best
way to learn basic.  I will take a course in Computer Information
Systems, next semester. I think the course just touches on Basic then
moves to other languages concentrating on C.  So, Im really just
trying to get my feet wet here.  But I will try to follow the content
of these groups as closely as I can and hopefully learn something from
real programmers.

Preach on!!
P.S. I welcome any suggestions and/or comment.

Quote:

>You didn't mention "where" the error was popping up but here's one..
>FUNCTION YesOrNo$ ( Question$ )
>>FUNCTION YesOrNo$
>And... while I'm at it!
>(scraping sounds of the soapbox being drug out from under the desk)
>(sounds of creaking wood as I step up)
>  Code like this has appeared in books on BASIC ever since the
>Commodore days and I firmly believe that it retards the learning
>process! It seems that, in an effort to "get published" and/or "keep
>it simple" and/or "provide instant, visual results" it skips over most
>of the very basic concepts that are, IMHO, vital to programming, in
>ANY language.
>  What lit my fuse (this time) was the use of INPUT and, more
>importantly, the way it was used! First of all, to use INPUT to gather
>info from the user is, at best, bad. If you're going to use it to
>input numeric values, first input strings then convert to a numeric
>value. Is this so difficult a concept that people can't understand it?
>  INPUT "Enter a number: ", N$
>  N! = VAL( N$ )
>  What, however, needs to be done, up front, is to create a small but
>efficient field editor. A simple task that takes but a few lines of
>simple, easy to understand code. This would teach newbies the
>importance of creating re-usable functions while providing a good
>foundation for future programming.
>  By the time one has progressed to the point where this style
>program/demo is required (s)he should already be versed in at least
>two functions: fGetKey$ (to gather individual key-presses ) and
>fInput$ (to gather field data). I can't imagine programming without
>either and have written similar items for at least 4 languages. In
>fact the _ONLY_ language that these were not the first functions
>written was Commodore BASIC and that is where I learned them.
>  Sorry for ramblin' on like this but...... Well, anyhow thanks for
>hanging in there.



Wed, 10 Mar 1999 03:00:00 GMT  
 Please Help /w QBasic Prog. 4 Dummies

Reposting article removed by rogue canceller.

Thank you all for your prompt helpful replies.  The code now runs as
it should. (I made mistakes in it everywhere!!)

Don I appreciate your concerns! I would like to know which is the best
way to learn basic.  I will take a course in Computer Information
Systems, next semester. I think the course just touches on Basic then
moves to other languages concentrating on C.  So, Im really just
trying to get my feet wet here.  But I will try to follow the content
of these groups as closely as I can and hopefully learn something from
real programmers.

Preach on!!
P.S. I welcome any suggestions and/or comment.

Quote:

>You didn't mention "where" the error was popping up but here's one..
>FUNCTION YesOrNo$ ( Question$ )
>>FUNCTION YesOrNo$
>And... while I'm at it!
>(scraping sounds of the soapbox being drug out from under the desk)
>(sounds of creaking wood as I step up)
>  Code like this has appeared in books on BASIC ever since the
>Commodore days and I firmly believe that it retards the learning
>process! It seems that, in an effort to "get published" and/or "keep
>it simple" and/or "provide instant, visual results" it skips over most
>of the very basic concepts that are, IMHO, vital to programming, in
>ANY language.
>  What lit my fuse (this time) was the use of INPUT and, more
>importantly, the way it was used! First of all, to use INPUT to gather
>info from the user is, at best, bad. If you're going to use it to
>input numeric values, first input strings then convert to a numeric
>value. Is this so difficult a concept that people can't understand it?
>  INPUT "Enter a number: ", N$
>  N! = VAL( N$ )
>  What, however, needs to be done, up front, is to create a small but
>efficient field editor. A simple task that takes but a few lines of
>simple, easy to understand code. This would teach newbies the
>importance of creating re-usable functions while providing a good
>foundation for future programming.
>  By the time one has progressed to the point where this style
>program/demo is required (s)he should already be versed in at least
>two functions: fGetKey$ (to gather individual key-presses ) and
>fInput$ (to gather field data). I can't imagine programming without
>either and have written similar items for at least 4 languages. In
>fact the _ONLY_ language that these were not the first functions
>written was Commodore BASIC and that is where I learned them.
>  Sorry for ramblin' on like this but...... Well, anyhow thanks for
>hanging in there.



Wed, 10 Mar 1999 03:00:00 GMT  
 Please Help /w QBasic Prog. 4 Dummies

Reposting article removed by rogue canceller.

Quote:

>Hello,
>I am trying to learn basic programming with QBasic Programming for
>Dummies a my first (well not really but..the other's were too old and
>to difficult to read) text book on the subject.  This book has sample
>programs (code..what ever..) that your suposed to type in and run as
>practice problems but the following code won't run it gives me an
>argument-count mismatch error(What ever that is.) Please help me get
>over this hump if you can.  Let me know if it's me or the author who
>screwed this code up?

<snip>

You didn't mention "where" the error was popping up but here's one..
FUNCTION YesOrNo$ ( Question$ )

Quote:
>FUNCTION YesOrNo$

And... while I'm at it!

(scraping sounds of the soapbox being drug out from under the desk)
(sounds of creaking wood as I step up)

  Code like this has appeared in books on BASIC ever since the
Commodore days and I firmly believe that it retards the learning
process! It seems that, in an effort to "get published" and/or "keep
it simple" and/or "provide instant, visual results" it skips over most
of the very basic concepts that are, IMHO, vital to programming, in
ANY language.

  What lit my fuse (this time) was the use of INPUT and, more
importantly, the way it was used! First of all, to use INPUT to gather
info from the user is, at best, bad. If you're going to use it to
input numeric values, first input strings then convert to a numeric
value. Is this so difficult a concept that people can't understand it?

  INPUT "Enter a number: ", N$
  N! = VAL( N$ )

  What, however, needs to be done, up front, is to create a small but
efficient field editor. A simple task that takes but a few lines of
simple, easy to understand code. This would teach newbies the
importance of creating re-usable functions while providing a good
foundation for future programming.

  By the time one has progressed to the point where this style
program/demo is required (s)he should already be versed in at least
two functions: fGetKey$ (to gather individual key-presses ) and
fInput$ (to gather field data). I can't imagine programming without
either and have written similar items for at least 4 languages. In
fact the _ONLY_ language that these were not the first functions
written was Commodore BASIC and that is where I learned them.

  Sorry for ramblin' on like this but...... Well, anyhow thanks for
{*filter*} in there.



Wed, 10 Mar 1999 03:00:00 GMT  
 Please Help /w QBasic Prog. 4 Dummies

Reposting article removed by rogue canceller.

: Hello,
: I am trying to learn basic programming with QBasic Programming for
: Dummies a my first (well not really but..the other's were too old and
: to difficult to read) text book on the subject.  This book has sample
: programs (code..what ever..) that your suposed to type in and run as
: practice problems but the following code won't run it gives me an
: argument-count mismatch error(What ever that is.) Please help me get
: over this hump if you can.  Let me know if it's me or the author who
: screwed this code up?
:
: Thanks,
: -and walk good!!!!
:

This is the error !

FUNCTION YesOrNo$

and this is correct mode:

FUNCTION YesOrNo$ (question$)

question$ is the missing parameter

ciao ciao

--
Roberto Marchini



Wed, 10 Mar 1999 03:00:00 GMT  
 Please Help /w QBasic Prog. 4 Dummies

DR>argument-count mismatch error(What ever that is.) Please help me get
DR>over this hump if you can.  Let me know if it's me or the author who

DR>FUNCTION YesOrNo$

This line should read:

FUNCTION YesOrNo$(question$)

The function statement has to have the same number of arguments as the
DECLARE FUNCTION statement at the top. That's why you're getting an
argument count mismatch.



Sat, 13 Mar 1999 03:00:00 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

2. Help, need a qbasic prog compiled!

3. Help for a dummy please

4. Adding Date parameters to my selection formula - Please help a dummy

5. dummy = dummy / 0

6. Please Help Me for control Internet Explorer by my prog

7. a EXE from a BIG Qbasic-Prog?

8. qbasic Com prog Question

9. Run Icon prog from inside Qbasic

10. Can anyone HELP me PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE

11. Qbasic help please!!!

 

 
Powered by phpBB® Forum Software