Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Operands of comparison operators must be of the same type?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
InfiniteAttack




PostPosted: Wed Mar 01, 2017 7:32 pm   Post subject: Operands of comparison operators must be of the same type?

What is it you are trying to achieve?
Debug the program


What is the problem you are having?
Error of "Operands of comparison operators must be of the same type"


Describe what you have tried to solve this problem
Read over the code and googled the problem.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

Turing:

View.Set ("graphics:max,max")

%Declarations
var lastname:string
var gender:char
var annual:real
var daybirth:int
var monthbirth:int
var yearbirth:int
var weekly:real

%Input
put "Enter your last name: "..
get lastname
put "Enter your gender (M/F): "..
get gender
put "Enter your annual salary: "..
get annual
put "Enter the day you were born (DD): "..
get daybirth
put "Enter the month you were born (MM): "..
get monthbirth
put "Enter the year you were born (YYYY): "..
get yearbirth

%Processing
weekly := annual / 52

%Output
Draw.Cls
if gender = "m" then
    put "Hello Mr. ", lastname
elsif gender = "M" then
    put "Hello Mr. ", lastname
elsif gender = "f" then
    put "Hello Ms. ", lastname
elsif gender = "F" then
    put "Hello Ms. ", lastname
else
    put "Invalid Gender!"
end if
put ""
put "You make: $", weekly:0:2, " per week"
put ""
put "You were born on ",

if monthbirth = "01" then
    put "January"
elsif monthbirth = "02" then
    put "Febuary "
else
    put "Invalid Month!"
end if




Please specify what version of Turing you are using
Turing 4.1.1 for Windows
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Thu Mar 02, 2017 4:19 pm   Post subject: RE:Operands of comparison operators must be of the same type?

With chars you use single quotes instead of double quotes. Double quotes are for strings.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: