Computer Science Canada

how to add decimal

Author:  lei4848 [ 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

Author:  person [ Sat Mar 25, 2006 6:22 pm ]
Post subject: 

code:

var num : real
get num
put num

Author:  Delos [ Sat Mar 25, 2006 6:31 pm ]
Post subject: 

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

Author:  TokenHerbz [ Sat Mar 25, 2006 8:28 pm ]
Post subject: 

just so you know...

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

code:

[code]
Print your code
[/code]


: