Thread: using readf in D
hi guys! i'm writing little program in d version did homework written in c. doesn't work well. first takes 2 reads first input user , second calculates tcsleep. compiled gdc , dmd , got same result. thank in advance!
code:import std.stdio; import std.c.stdlib; void main() { immutable sitc = 1.66; immutable sleepc = 1.08; float tcsleep, tcsit, tc; int minsleep, minsit; write("input number of minutes sleep : \n"); readf("%d ", &minsleep); write("input number of minutes sitting : \n"); readf("%d ", &minsit); write("thanks!\n"); tcsleep = minsit*sitc; tcsit = minsleep*sleepc; tc = tcsleep+tcsit; writeln("your total calories : ", tc); exit (0); }
solved!
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk using readf in D
Ubuntu
Comments
Post a Comment