home *** CD-ROM | disk | FTP | other *** search
/ Sams Teach Yourself C in 21 Days (6th Edition) / STYC216E.ISO / mac / Examples / Day11 / struct.c < prev    next >
MacBinary  |  2002-05-02  |  1.9 KB  |  [TEXT/LMAN]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Thu May 2 22:05:50 2002, modified Thu May 2 22:05:50 2002, creator 'LMAN', type ASCII, 1335 bytes "struct.c" , at 0x5b7 286 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[LMAN]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 73 74 72 75 63 74 | 2e 63 00 00 00 00 00 00 |..struct|.c......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4c 4d 41 | 4e 00 00 ff ff ff ff 00 |.TEXTLMA|N.......|
|00000050| 00 00 00 00 00 05 37 00 | 00 01 1e b8 f7 a0 fe b8 |......7.|........|
|00000060| f7 a0 fe 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 62 dc 00 00 |........|....b...|
|00000080| 2f 2a 20 44 65 6d 6f 6e | 73 74 72 61 74 65 73 20 |/* Demon|strates |
|00000090| 73 74 72 75 63 74 75 72 | 65 73 20 74 68 61 74 20 |structur|es that |
|000000a0| 63 6f 6e 74 61 69 6e 20 | 6f 74 68 65 72 20 73 74 |contain |other st|
|000000b0| 72 75 63 74 75 72 65 73 | 2e 20 2a 2f 0d 0a 0d 0a |ructures|. */....|
|000000c0| 2f 2a 20 52 65 63 65 69 | 76 65 73 20 69 6e 70 75 |/* Recei|ves inpu|
|000000d0| 74 20 66 6f 72 20 63 6f | 72 6e 65 72 20 63 6f 6f |t for co|rner coo|
|000000e0| 72 64 69 6e 61 74 65 73 | 20 6f 66 20 61 20 72 65 |rdinates| of a re|
|000000f0| 63 74 61 6e 67 6c 65 20 | 61 6e 64 0d 0a 20 20 20 |ctangle |and.. |
|00000100| 63 61 6c 63 75 6c 61 74 | 65 73 20 74 68 65 20 61 |calculat|es the a|
|00000110| 72 65 61 2e 20 41 73 73 | 75 6d 65 73 20 74 68 61 |rea. Ass|umes tha|
|00000120| 74 20 74 68 65 20 79 20 | 63 6f 6f 72 64 69 6e 61 |t the y |coordina|
|00000130| 74 65 20 6f 66 20 74 68 | 65 0d 0a 20 20 20 6c 6f |te of th|e.. lo|
|00000140| 77 65 72 2d 72 69 67 68 | 74 20 63 6f 72 6e 65 72 |wer-righ|t corner|
|00000150| 20 69 73 20 67 72 65 61 | 74 65 72 20 74 68 61 6e | is grea|ter than|
|00000160| 20 74 68 65 20 79 20 63 | 6f 6f 72 64 69 6e 61 74 | the y c|oordinat|
|00000170| 65 20 6f 66 20 74 68 65 | 0d 0a 20 20 20 75 70 70 |e of the|.. upp|
|00000180| 65 72 2d 6c 65 66 74 20 | 63 6f 72 6e 65 72 2c 20 |er-left |corner, |
|00000190| 74 68 61 74 20 74 68 65 | 20 78 20 63 6f 6f 72 64 |that the| x coord|
|000001a0| 69 6e 61 74 65 20 6f 66 | 20 74 68 65 20 6c 6f 77 |inate of| the low|
|000001b0| 65 72 2d 0d 0a 20 20 20 | 72 69 67 68 74 20 63 6f |er-.. |right co|
|000001c0| 72 6e 65 72 20 69 73 20 | 67 72 65 61 74 65 72 20 |rner is |greater |
|000001d0| 74 68 61 6e 20 74 68 65 | 20 78 20 63 6f 6f 72 64 |than the| x coord|
|000001e0| 69 6e 61 74 65 20 6f 66 | 20 74 68 65 20 75 70 70 |inate of| the upp|
|000001f0| 65 72 2d 0d 0a 20 20 20 | 6c 65 66 74 20 63 6f 72 |er-.. |left cor|
|00000200| 6e 65 72 2c 20 61 6e 64 | 20 74 68 61 74 20 61 6c |ner, and| that al|
|00000210| 6c 20 63 6f 6f 72 64 69 | 6e 61 74 65 73 20 61 72 |l coordi|nates ar|
|00000220| 65 20 70 6f 73 69 74 69 | 76 65 2e 20 2a 2f 0d 0a |e positi|ve. */..|
|00000230| 0d 0a 23 69 6e 63 6c 75 | 64 65 20 3c 73 74 64 69 |..#inclu|de <stdi|
|00000240| 6f 2e 68 3e 0d 0a 0d 0a | 69 6e 74 20 6c 65 6e 67 |o.h>....|int leng|
|00000250| 74 68 2c 20 77 69 64 74 | 68 3b 0d 0a 6c 6f 6e 67 |th, widt|h;..long|
|00000260| 20 61 72 65 61 3b 0d 0a | 0d 0a 73 74 72 75 63 74 | area;..|..struct|
|00000270| 20 63 6f 6f 72 64 7b 0d | 0a 20 20 20 20 69 6e 74 | coord{.|. int|
|00000280| 20 78 3b 0d 0a 20 20 20 | 20 69 6e 74 20 79 3b 0d | x;.. | int y;.|
|00000290| 0a 7d 3b 0d 0a 0d 0a 73 | 74 72 75 63 74 20 72 65 |.};....s|truct re|
|000002a0| 63 74 61 6e 67 6c 65 7b | 0d 0a 20 20 20 20 73 74 |ctangle{|.. st|
|000002b0| 72 75 63 74 20 63 6f 6f | 72 64 20 74 6f 70 6c 65 |ruct coo|rd tople|
|000002c0| 66 74 3b 0d 0a 20 20 20 | 20 73 74 72 75 63 74 20 |ft;.. | struct |
|000002d0| 63 6f 6f 72 64 20 62 6f | 74 74 6f 6d 72 74 3b 0d |coord bo|ttomrt;.|
|000002e0| 0a 7d 20 6d 79 62 6f 78 | 3b 0d 0a 0d 0a 69 6e 74 |.} mybox|;....int|
|000002f0| 20 6d 61 69 6e 28 20 76 | 6f 69 64 20 29 0d 0a 7b | main( v|oid )..{|
|00000300| 0d 0a 20 20 20 20 2f 2a | 20 49 6e 70 75 74 20 74 |.. /*| Input t|
|00000310| 68 65 20 63 6f 6f 72 64 | 69 6e 61 74 65 73 20 2a |he coord|inates *|
|00000320| 2f 0d 0a 0d 0a 20 20 20 | 20 70 72 69 6e 74 66 28 |/.... | printf(|
|00000330| 22 5c 6e 45 6e 74 65 72 | 20 74 68 65 20 74 6f 70 |"\nEnter| the top|
|00000340| 20 6c 65 66 74 20 78 20 | 63 6f 6f 72 64 69 6e 61 | left x |coordina|
|00000350| 74 65 3a 20 22 29 3b 0d | 0a 20 20 20 20 73 63 61 |te: ");.|. sca|
|00000360| 6e 66 28 22 25 64 22 2c | 20 26 6d 79 62 6f 78 2e |nf("%d",| &mybox.|
|00000370| 74 6f 70 6c 65 66 74 2e | 78 29 3b 0d 0a 0d 0a 20 |topleft.|x);.... |
|00000380| 20 20 20 70 72 69 6e 74 | 66 28 22 5c 6e 45 6e 74 | print|f("\nEnt|
|00000390| 65 72 20 74 68 65 20 74 | 6f 70 20 6c 65 66 74 20 |er the t|op left |
|000003a0| 79 20 63 6f 6f 72 64 69 | 6e 61 74 65 3a 20 22 29 |y coordi|nate: ")|
|000003b0| 3b 0d 0a 20 20 20 20 73 | 63 61 6e 66 28 22 25 64 |;.. s|canf("%d|
|000003c0| 22 2c 20 26 6d 79 62 6f | 78 2e 74 6f 70 6c 65 66 |", &mybo|x.toplef|
|000003d0| 74 2e 79 29 3b 0d 0a 0d | 0a 20 20 20 20 70 72 69 |t.y);...|. pri|
|000003e0| 6e 74 66 28 22 5c 6e 45 | 6e 74 65 72 20 74 68 65 |ntf("\nE|nter the|
|000003f0| 20 62 6f 74 74 6f 6d 20 | 72 69 67 68 74 20 78 20 | bottom |right x |
|00000400| 63 6f 6f 72 64 69 6e 61 | 74 65 3a 20 22 29 3b 0d |coordina|te: ");.|
|00000410| 0a 20 20 20 20 73 63 61 | 6e 66 28 22 25 64 22 2c |. sca|nf("%d",|
|00000420| 20 26 6d 79 62 6f 78 2e | 62 6f 74 74 6f 6d 72 74 | &mybox.|bottomrt|
|00000430| 2e 78 29 3b 0d 0a 0d 0a | 20 20 20 20 70 72 69 6e |.x);....| prin|
|00000440| 74 66 28 22 5c 6e 45 6e | 74 65 72 20 74 68 65 20 |tf("\nEn|ter the |
|00000450| 62 6f 74 74 6f 6d 20 72 | 69 67 68 74 20 79 20 63 |bottom r|ight y c|
|00000460| 6f 6f 72 64 69 6e 61 74 | 65 3a 20 22 29 3b 0d 0a |oordinat|e: ");..|
|00000470| 20 20 20 20 73 63 61 6e | 66 28 22 25 64 22 2c 20 | scan|f("%d", |
|00000480| 26 6d 79 62 6f 78 2e 62 | 6f 74 74 6f 6d 72 74 2e |&mybox.b|ottomrt.|
|00000490| 79 29 3b 0d 0a 0d 0a 20 | 20 20 20 2f 2a 20 43 61 |y);.... | /* Ca|
|000004a0| 6c 63 75 6c 61 74 65 20 | 74 68 65 20 6c 65 6e 67 |lculate |the leng|
|000004b0| 74 68 20 61 6e 64 20 77 | 69 64 74 68 20 2a 2f 0d |th and w|idth */.|
|000004c0| 0a 0d 0a 20 20 20 20 77 | 69 64 74 68 20 3d 20 6d |... w|idth = m|
|000004d0| 79 62 6f 78 2e 62 6f 74 | 74 6f 6d 72 74 2e 78 20 |ybox.bot|tomrt.x |
|000004e0| 2d 20 6d 79 62 6f 78 2e | 74 6f 70 6c 65 66 74 2e |- mybox.|topleft.|
|000004f0| 78 3b 0d 0a 20 20 20 20 | 6c 65 6e 67 74 68 20 3d |x;.. |length =|
|00000500| 20 6d 79 62 6f 78 2e 62 | 6f 74 74 6f 6d 72 74 2e | mybox.b|ottomrt.|
|00000510| 79 20 2d 20 6d 79 62 6f | 78 2e 74 6f 70 6c 65 66 |y - mybo|x.toplef|
|00000520| 74 2e 79 3b 0d 0a 0d 0a | 20 20 20 20 2f 2a 20 43 |t.y;....| /* C|
|00000530| 61 6c 63 75 6c 61 74 65 | 20 61 6e 64 20 64 69 73 |alculate| and dis|
|00000540| 70 6c 61 79 20 74 68 65 | 20 61 72 65 61 20 2a 2f |play the| area */|
|00000550| 0d 0a 0d 0a 20 20 20 20 | 61 72 65 61 20 3d 20 77 |.... |area = w|
|00000560| 69 64 74 68 20 2a 20 6c | 65 6e 67 74 68 3b 0d 0a |idth * l|ength;..|
|00000570| 20 20 20 20 70 72 69 6e | 74 66 28 22 5c 6e 54 68 | prin|tf("\nTh|
|00000580| 65 20 61 72 65 61 20 69 | 73 20 25 6c 64 20 75 6e |e area i|s %ld un|
|00000590| 69 74 73 2e 5c 6e 22 2c | 20 61 72 65 61 29 3b 0d |its.\n",| area);.|
|000005a0| 0a 0d 0a 20 20 20 20 72 | 65 74 75 72 6e 20 30 3b |... r|eturn 0;|
|000005b0| 0d 0a 7d 0d 0a 0d 0a 00 | 00 00 00 00 00 00 00 00 |..}.....|........|
|000005c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000600| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000610| 54 68 69 73 20 72 65 73 | 6f 75 72 63 65 20 66 6f |This res|ource fo|
|00000620| 72 6b 20 69 6e 74 65 6e | 74 69 6f 6e 61 6c 6c 79 |rk inten|tionally|
|00000630| 20 6c 65 66 74 20 62 6c | 61 6e 6b 20 20 20 00 00 | left bl|ank ..|
|00000640| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000650| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000660| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000670| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000680| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000690| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000700| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000710| 00 00 00 00 00 00 00 00 | 00 1c 00 1e ff ff 00 00 |........|........|
|00000720| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000730| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000740| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000750| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000770| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+