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

Username:   Password: 
 RegisterRegister   
 how to add decimal
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
lei4848




PostPosted: Sat Mar 25, 2006 6:17 pm   Post subject: how to add decimal

i have a program below where the user enter a two digit number and it will output the same 2 digit numbers....i was wondering how you are able to add decimal such as 2.4 and the output will give you 2.4

var str : string
var number : int := 0

get str
for i : 1 .. length (str)
number *= 10
number += (ord (str (i)) - 48)
end for
put number
put number * 2
Sponsor
Sponsor
Sponsor
sponsor
person




PostPosted: Sat Mar 25, 2006 6:22 pm   Post subject: (No subject)

code:

var num : real
get num
put num
Delos




PostPosted: Sat Mar 25, 2006 6:31 pm   Post subject: (No subject)

lei4848, you have been asked before to use [code] tags when posting code. Please follow this convention.
TokenHerbz




PostPosted: Sat Mar 25, 2006 8:28 pm   Post subject: (No subject)

just so you know...

you type you info here and when you post your code:
type this:

code:

[code]
Print your code
[/code]
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  [ 4 Posts ]
Jump to:   


Style:  
Search: