Beginner programming - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Beginner programming

Rafter33Rafter33 Posts: 1Member
Hi,
I'm working on my homework which is about creating a program that calculate grades and marks.
When running my program I receive the error message TYPE MISMATCH, especially on functions like

Let Total$= (Asmark + Finmark + Exmark)/ 3

If Asmark >= 60 then.....
...
The message highlights the numbers...

I will appreciate if someone can help me on this.

Thanks in advance.


Comments

  • Davide VecchiDavide Vecchi Posts: 17Member
    : Hi,
    : I'm working on my homework which is about creating a program that calculate grades and marks.
    : When running my program I receive the error message TYPE MISMATCH, especially on functions like
    :
    : Let Total$= (Asmark + Finmark + Exmark)/ 3
    :
    : If Asmark >= 60 then.....
    : ...
    : The message highlights the numbers...
    :
    : I will appreciate if someone can help me on this.
    :
    : Thanks in advance.
    :
    :
    :

    You' re trying to assign a numeric value to a string variable.

    [code]Let Total[b]$[/b]= (Asmark + Finmark + Exmark)/ 3[/code]

    Strip the $ sign.
  • VB5begginnerVB5begginner Posts: 66Member
    : : Hi,
    : : I'm working on my homework which is about creating a program that calculate grades and marks.
    : : When running my program I receive the error message TYPE MISMATCH, especially on functions like
    : :
    : : Let Total$= (Asmark + Finmark + Exmark)/ 3
    : :
    : : If Asmark >= 60 then.....
    : : ...
    : : The message highlights the numbers...
    : :
    : : I will appreciate if someone can help me on this.
    : :
    : : Thanks in advance.
    : :
    : :
    : :
    :
    : You' re trying to assign a numeric value to a string variable.
    :
    : [code]Let Total[b]$[/b]= (Asmark + Finmark + Exmark)/ 3[/code]
    :
    : Strip the $ sign.
    :


    or if you would like to have the amount as a string, use the STR$([italic]value[/italic])function...like so:

    [code]
    LET Total$ = STR$((Asmark + Finmark + Exmark) / 3)
    [/code]

    plus...unless you are either required to by your instructor, or are working on an [b]OLD[/b] version of basic (pre QBasic)...then strip the LET... Total$ = STR$((Asmark + Finmark + Exmark) / 3) will work just as good...there's no point in using a LET statement
Sign In or Register to comment.