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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# Beginner programming

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.

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