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

Username:   Password: 
 RegisterRegister   
 Subracting a varaible from an other varaible
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
david92ng




PostPosted: Fri Oct 26, 2007 7:46 pm   Post subject: Subracting a varaible from an other varaible

Hey,

lets say we have a code like this:

code:
var money : real
var bet :real


so..... I declared it but I don't know how to subtract the bet from the ammout of money.
If you havnt figured it out yet, im makeing a card game.

Im looking for a code something like this:

code:
money := money - bet


but everyone here knows this wont work... LOL but you get my idea rite?

Any suggestions? or is there a better way of doing this?
Thanks, asap is good
Sponsor
Sponsor
Sponsor
sponsor
david92ng




PostPosted: Fri Oct 26, 2007 7:47 pm   Post subject: Re: Subracting a varaible from an other varaible

ummm... yea... im kinda new to turing
SNIPERDUDE




PostPosted: Fri Oct 26, 2007 8:56 pm   Post subject: Re: Subracting a varaible from an other varaible

Ummm, no. I don't get what you mean, you will have to be more specific...
rdrake




PostPosted: Fri Oct 26, 2007 9:26 pm   Post subject: RE:Subracting a varaible from an other varaible

code:
money -= bet

...?
CodeMonkey2000




PostPosted: Fri Oct 26, 2007 9:27 pm   Post subject: Re: Subracting a varaible from an other varaible

david92ng @ Fri Oct 26, 2007 7:46 pm wrote:

code:
money := money - bet

but everyone here knows this wont work... LOL but you get my idea rite?


That code will work. But money and bet need to be assigned a value first.
Nick




PostPosted: Fri Oct 26, 2007 9:38 pm   Post subject: RE:Subracting a varaible from an other varaible

well ur code will work but there is a better way to do it and rdrake has got it

the money-=bet will act as tho u said money:=money - bet also there is += which is money:=money + bet and also ~= which is not = of money:= money not= bet (usually used for boolean varibles

but what u are looking for is the -= (and possibly += if they win the hand) this is how it will look

Turing:
var money:real
var bet:real

%assign bet and money to a value
money:=1000
put "How much will you bet?"
get bet

money-=bet

%some code here

if win then
   money+=bet
end if
david92ng




PostPosted: Fri Oct 26, 2007 10:18 pm   Post subject: Re: Subracting a varaible from an other varaible

ah thanks, thats exactly what im looking for. like my old code didnt subtract as the output. i think i know why now. thanks for all your help guys.
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  [ 7 Posts ]
Jump to:   


Style:  
Search: