{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture_notes_15

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

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

I I - --

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

View Full Document
/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 ---
- , \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

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

View Full Document
9 .3 <:> ./ I (. :> -+ --::) o. - J>
- . ::s- -t - , :3 (0 l' ~ 3: o ~ !r ~ " A ro I",..- .

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

View Full Document
?-. 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 .
-'\) 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 -,

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

View Full Document

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

View Full Document

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}