how can I display the integer value of a variable...
e.g. say I have a variable t1 ( to represent time ) which is entered from the keyboard and has a value of 1525 ( 3.25pm) and I divide this by 100 to give the hours as 15 how do I print this on the screen....which is technically calculating hours and minutes and breaking 1525 into 2 parts... 15 and 25
In Basic I can say ti = int( t1/100) but in Turbo C I cannot do this..
I an converting a program from QBasic to Turbo C ( Supplied as study material ) and can`t work it out.......
portion of code I am trying to do is..... ( In QBasic )
input"",t1
input "",t2
h1 = int(t1 / 100)
m1 = t1 - (h1 * 100)
h2 = int(t2 / 100)
m2 = t2 - (h2 * 100)
diff = int(h2 * 60 + m2) - (h1 * 60 + m1)
dh = int(diff / 60)
dm = diff -(dh * 60)
print dh,dm
Any help would be appreciated...



LinkBack URL
About LinkBacks


