{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture_notes_15 - I I/Users/sjp/Desktop/chapter12_code...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon
I I - --
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
/Users/sjp/Desktop/chapter12_code Folderlfig 12.4.c #include <stdio.h> int mainO { int amount; int rate; int ti.me; /* The number of bytes to be transferred */ /* The average network transfer rate */ /* The ti.me, i.n seconds, for the transfer */ i.nt hours; i.nt mi.nutes; int seconds; /* The n~er of hours for the transfer /* The number of mins for the transfer /* The number of secs for the transfer */ */ */ /* Get input: number of bytes and network transfer rate */ pri.ntf("How many bytes of data to be transferred? "); scanf("%d", &amount); pri.ntf("What is the transfer rate (in bytes/see)? "); scanf("%d", &rate); /* Calculate total time in seconds */ ~ ti.me = amount / rate; /* Convert time into hours, minutes, seconds */ hours = ti.me / 3600; /* 3600 seconds in an hour */ mi.nutes = (ti.me % 3600) / 60; /* 60 seconds in a minute */ seconds = ((ti.me % 3600) % 60); /* remainder is seconds */ /* Output results */ pri.ntf("Transfer Time: %dh %dm%ds\n", hours, mi.nutes, seconds); } Printed: 2/28/08 9:41 AM . Page 1 ---
Background image of page 2
- , \I) f 3- >1 I. - :> $ ,- .. e- :; 0 5t- (.. 0 f ..., l... c:: JJ> v , J I II j I j i J I , jO J'11V\ - vJ j I -J- I i ,.- -- .... ' -1 - . :> - . -, ' ;7 ;!$ ;!$ --\- -\- ...... \-- ..... L. -+ -\- I 3 3'> } 3 V1 .> ". ..... ,,- - ' -' - .-<, ? ........ --. - , ? ", $> 5 I (0 I I J -/ , I - J
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
9 .3 <:> ./ I (. :> -+ --::) o. - J>
Background image of page 4
- . ::s- -t - , :3 (0 l' ~ 3: o ~ !r ~ " A ro I",..- .
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
?-. o o o o i t ...q r -- -- ------ i . 1 \ if) r1 c>' --J c.I' -L V) ,..-- ,., -L. .J :> < & ;+. .... < 1 (0 f! ;, (0 6" > . -- -- ,. -" ?' 0 S?:: V\ C b r r .
Background image of page 6
-'\) 0 :> ..., 5<=" " --() 4- (l (1 .., 0 t- v <:) Co> <- Q c:. <.. E, > > > "1 (f -+ (' p , .... , , +- ra (\ ....... , (1 ,-... c 0 (., Co A ? > > ,,} + ('\ ..---- -- 0 0 - . . G > 4 1 0 1 -, -... , \J\ -<J -,
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 8
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 10
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 12
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 14
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}