home *** CD-ROM | disk | FTP | other *** search
/ Sams Teach Yourself C in 21 Days (6th Edition) / STYC216E.ISO / mac / Examples / Day13 / menu.c < prev    next >
MacBinary  |  2002-05-04  |  2.0 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
10% dexvert Jesper Olsen Module (music/jesperOlsen) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Sat May 4 14:18:32 2002, modified Sat May 4 14:18:32 2002, creator 'LMAN', type ASCII, 1519 bytes "menu.c" , at 0x66f 286 bytes resource default (weak)
99% file data default
49% TrID Macintosh plain text (MacBinary) default
33% TrID TTComp archive compressed (bin-4K) default (weak)
16% 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 06 6d 65 6e 75 2e 63 | 00 00 00 00 00 00 00 00 |..menu.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 ef 00 | 00 01 1e b8 f9 d6 78 b8 |........|......x.|
|00000060| f9 d6 78 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..x.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 d5 34 00 00 |........|.....4..|
|00000080| 2f 2a 20 44 65 6d 6f 6e | 73 74 72 61 74 65 73 20 |/* Demon|strates |
|00000090| 75 73 69 6e 67 20 61 6e | 20 69 6e 66 69 6e 69 74 |using an| infinit|
|000000a0| 65 20 6c 6f 6f 70 20 74 | 6f 20 69 6d 70 6c 65 6d |e loop t|o implem|
|000000b0| 65 6e 74 20 2a 2f 0d 0a | 2f 2a 20 61 20 6d 65 6e |ent */..|/* a men|
|000000c0| 75 20 73 79 73 74 65 6d | 2e 20 2a 2f 0d 0a 23 69 |u system|. */..#i|
|000000d0| 6e 63 6c 75 64 65 20 3c | 73 74 64 69 6f 2e 68 3e |nclude <|stdio.h>|
|000000e0| 0d 0a 23 64 65 66 69 6e | 65 20 44 45 4c 41 59 20 |..#defin|e DELAY |
|000000f0| 20 31 35 30 30 30 30 30 | 30 20 20 20 20 20 20 20 | 1500000|0 |
|00000100| 2f 2a 20 55 73 65 64 20 | 69 6e 20 64 65 6c 61 79 |/* Used |in delay|
|00000110| 20 6c 6f 6f 70 2e 20 2a | 2f 0d 0a 0d 0a 69 6e 74 | loop. *|/....int|
|00000120| 20 6d 65 6e 75 28 76 6f | 69 64 29 3b 0d 0a 76 6f | menu(vo|id);..vo|
|00000130| 69 64 20 64 65 6c 61 79 | 28 76 6f 69 64 29 3b 0d |id delay|(void);.|
|00000140| 0a 0d 0a 69 6e 74 20 6d | 61 69 6e 28 20 76 6f 69 |...int m|ain( voi|
|00000150| 64 20 29 0d 0a 7b 0d 0a | 20 20 20 69 6e 74 20 63 |d )..{..| int c|
|00000160| 68 6f 69 63 65 3b 0d 0a | 0d 0a 20 20 20 77 68 69 |hoice;..|.. whi|
|00000170| 6c 65 20 28 31 29 0d 0a | 20 20 20 7b 0d 0a 0d 0a |le (1)..| {....|
|00000180| 20 20 20 20 2f 2a 20 47 | 65 74 20 74 68 65 20 75 | /* G|et the u|
|00000190| 73 65 72 27 73 20 73 65 | 6c 65 63 74 69 6f 6e 2e |ser's se|lection.|
|000001a0| 20 2a 2f 0d 0a 0d 0a 20 | 20 20 20 63 68 6f 69 63 | */.... | choic|
|000001b0| 65 20 3d 20 6d 65 6e 75 | 28 29 3b 0d 0a 0d 0a 20 |e = menu|();.... |
|000001c0| 20 20 20 2f 2a 20 42 72 | 61 6e 63 68 20 62 61 73 | /* Br|anch bas|
|000001d0| 65 64 20 6f 6e 20 74 68 | 65 20 69 6e 70 75 74 2e |ed on th|e input.|
|000001e0| 20 2a 2f 0d 0a 0d 0a 20 | 20 20 20 69 66 20 28 63 | */.... | if (c|
|000001f0| 68 6f 69 63 65 20 3d 3d | 20 31 29 0d 0a 20 20 20 |hoice ==| 1).. |
|00000200| 20 7b 0d 0a 20 20 20 20 | 20 20 20 20 70 75 74 73 | {.. | puts|
|00000210| 28 22 5c 6e 45 78 65 63 | 75 74 69 6e 67 20 74 61 |("\nExec|uting ta|
|00000220| 73 6b 20 41 2e 22 29 3b | 0d 0a 20 20 20 20 20 20 |sk A.");|.. |
|00000230| 20 20 64 65 6c 61 79 28 | 29 3b 0d 0a 20 20 20 20 | delay(|);.. |
|00000240| 7d 0d 0a 20 20 20 20 65 | 6c 73 65 20 69 66 20 28 |}.. e|lse if (|
|00000250| 63 68 6f 69 63 65 20 3d | 3d 20 32 29 0d 0a 20 20 |choice =|= 2).. |
|00000260| 20 20 20 20 20 20 20 7b | 0d 0a 20 20 20 20 20 20 | {|.. |
|00000270| 20 20 20 20 20 20 20 70 | 75 74 73 28 22 5c 6e 45 | p|uts("\nE|
|00000280| 78 65 63 75 74 69 6e 67 | 20 74 61 73 6b 20 42 2e |xecuting| task B.|
|00000290| 22 29 3b 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |");.. | |
|000002a0| 20 20 64 65 6c 61 79 28 | 29 3b 0d 0a 20 20 20 20 | delay(|);.. |
|000002b0| 20 20 20 20 20 7d 0d 0a | 20 20 20 20 65 6c 73 65 | }..| else|
|000002c0| 20 69 66 20 28 63 68 6f | 69 63 65 20 3d 3d 20 33 | if (cho|ice == 3|
|000002d0| 29 0d 0a 20 20 20 20 20 | 20 20 20 20 7b 0d 0a 20 |).. | {.. |
|000002e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 70 75 74 73 | | puts|
|000002f0| 28 22 5c 6e 45 78 65 63 | 75 74 69 6e 67 20 74 61 |("\nExec|uting ta|
|00000300| 73 6b 20 43 2e 22 29 3b | 0d 0a 20 20 20 20 20 20 |sk C.");|.. |
|00000310| 20 20 20 20 20 20 20 64 | 65 6c 61 79 28 29 3b 0d | d|elay();.|
|00000320| 0a 20 20 20 20 20 20 20 | 20 20 7d 0d 0a 20 20 20 |. | }.. |
|00000330| 20 65 6c 73 65 20 69 66 | 20 28 63 68 6f 69 63 65 | else if| (choice|
|00000340| 20 3d 3d 20 34 29 0d 0a | 20 20 20 20 20 20 20 20 | == 4)..| |
|00000350| 20 7b 0d 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 | {.. | |
|00000360| 20 70 75 74 73 28 22 5c | 6e 45 78 65 63 75 74 69 | puts("\|nExecuti|
|00000370| 6e 67 20 74 61 73 6b 20 | 44 2e 22 29 3b 0d 0a 20 |ng task |D.");.. |
|00000380| 20 20 20 20 20 20 20 20 | 20 20 20 20 64 65 6c 61 | | dela|
|00000390| 79 28 29 3b 0d 0a 20 20 | 20 20 20 20 20 20 20 7d |y();.. | }|
|000003a0| 0d 0a 20 20 20 20 65 6c | 73 65 20 69 66 20 28 63 |.. el|se if (c|
|000003b0| 68 6f 69 63 65 20 3d 3d | 20 35 29 20 20 20 20 20 |hoice ==| 5) |
|000003c0| 20 20 2f 2a 20 45 78 69 | 74 20 70 72 6f 67 72 61 | /* Exi|t progra|
|000003d0| 6d 2e 20 2a 2f 0d 0a 20 | 20 20 20 20 20 20 20 20 |m. */.. | |
|000003e0| 7b 0d 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |{.. | |
|000003f0| 70 75 74 73 28 22 5c 6e | 45 78 69 74 69 6e 67 20 |puts("\n|Exiting |
|00000400| 70 72 6f 67 72 61 6d 20 | 6e 6f 77 2e 2e 2e 5c 6e |program |now...\n|
|00000410| 22 29 3b 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |");.. | |
|00000420| 20 20 64 65 6c 61 79 28 | 29 3b 0d 0a 20 20 20 20 | delay(|);.. |
|00000430| 20 20 20 20 20 20 20 20 | 20 62 72 65 61 6b 3b 0d | | break;.|
|00000440| 0a 20 20 20 20 20 20 20 | 20 20 7d 0d 0a 20 20 20 |. | }.. |
|00000450| 20 20 20 20 20 20 65 6c | 73 65 0d 0a 20 20 20 20 | el|se.. |
|00000460| 20 20 20 20 20 7b 0d 0a | 20 20 20 20 20 20 20 20 | {..| |
|00000470| 20 20 20 20 20 70 75 74 | 73 28 22 5c 6e 49 6e 76 | put|s("\nInv|
|00000480| 61 6c 69 64 20 63 68 6f | 69 63 65 2c 20 74 72 79 |alid cho|ice, try|
|00000490| 20 61 67 61 69 6e 2e 22 | 29 3b 0d 0a 20 20 20 20 | again."|);.. |
|000004a0| 20 20 20 20 20 20 20 20 | 20 64 65 6c 61 79 28 29 | | delay()|
|000004b0| 3b 0d 0a 20 20 20 20 20 | 20 20 20 20 7d 0d 0a 20 |;.. | }.. |
|000004c0| 20 20 7d 0d 0a 20 20 20 | 72 65 74 75 72 6e 20 30 | }.. |return 0|
|000004d0| 3b 0d 0a 7d 0d 0a 0d 0a | 2f 2a 20 44 69 73 70 6c |;..}....|/* Displ|
|000004e0| 61 79 73 20 61 20 6d 65 | 6e 75 20 61 6e 64 20 69 |ays a me|nu and i|
|000004f0| 6e 70 75 74 73 20 75 73 | 65 72 27 73 20 73 65 6c |nputs us|er's sel|
|00000500| 65 63 74 69 6f 6e 2e 20 | 2a 2f 0d 0a 69 6e 74 20 |ection. |*/..int |
|00000510| 6d 65 6e 75 28 76 6f 69 | 64 29 0d 0a 7b 0d 0a 20 |menu(voi|d)..{.. |
|00000520| 20 20 20 69 6e 74 20 72 | 65 70 6c 79 3b 0d 0a 0d | int r|eply;...|
|00000530| 0a 20 20 20 20 70 75 74 | 73 28 22 5c 6e 45 6e 74 |. put|s("\nEnt|
|00000540| 65 72 20 31 20 66 6f 72 | 20 74 61 73 6b 20 41 2e |er 1 for| task A.|
|00000550| 22 29 3b 0d 0a 20 20 20 | 20 70 75 74 73 28 22 45 |");.. | puts("E|
|00000560| 6e 74 65 72 20 32 20 66 | 6f 72 20 74 61 73 6b 20 |nter 2 f|or task |
|00000570| 42 2e 22 29 3b 0d 0a 20 | 20 20 20 70 75 74 73 28 |B.");.. | puts(|
|00000580| 22 45 6e 74 65 72 20 33 | 20 66 6f 72 20 74 61 73 |"Enter 3| for tas|
|00000590| 6b 20 43 2e 22 29 3b 0d | 0a 20 20 20 20 70 75 74 |k C.");.|. put|
|000005a0| 73 28 22 45 6e 74 65 72 | 20 34 20 66 6f 72 20 74 |s("Enter| 4 for t|
|000005b0| 61 73 6b 20 44 2e 22 29 | 3b 0d 0a 20 20 20 20 70 |ask D.")|;.. p|
|000005c0| 75 74 73 28 22 45 6e 74 | 65 72 20 35 20 74 6f 20 |uts("Ent|er 5 to |
|000005d0| 65 78 69 74 20 70 72 6f | 67 72 61 6d 2e 22 29 3b |exit pro|gram.");|
|000005e0| 0d 0a 0d 0a 20 20 20 20 | 73 63 61 6e 66 28 22 25 |.... |scanf("%|
|000005f0| 64 22 2c 20 26 72 65 70 | 6c 79 29 3b 0d 0a 0d 0a |d", &rep|ly);....|
|00000600| 20 20 20 20 72 65 74 75 | 72 6e 20 72 65 70 6c 79 | retu|rn reply|
|00000610| 3b 0d 0a 7d 0d 0a 0d 0a | 76 6f 69 64 20 64 65 6c |;..}....|void del|
|00000620| 61 79 28 20 76 6f 69 64 | 20 29 0d 0a 7b 0d 0a 20 |ay( void| )..{.. |
|00000630| 20 20 20 6c 6f 6e 67 20 | 78 3b 0d 0a 20 20 20 20 | long |x;.. |
|00000640| 66 6f 72 20 28 20 78 20 | 3d 20 30 3b 20 78 20 3c |for ( x |= 0; x <|
|00000650| 20 44 45 4c 41 59 3b 20 | 78 2b 2b 20 29 0d 0a 20 | DELAY; |x++ ).. |
|00000660| 20 20 20 20 20 20 20 3b | 0d 0a 7d 0d 0a 0d 0a 00 | ;|..}.....|
|00000670| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000680| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000690| 54 68 69 73 20 72 65 73 | 6f 75 72 63 65 20 66 6f |This res|ource fo|
|000006a0| 72 6b 20 69 6e 74 65 6e | 74 69 6f 6e 61 6c 6c 79 |rk inten|tionally|
|000006b0| 20 6c 65 66 74 20 62 6c | 61 6e 6b 20 20 20 00 00 | left bl|ank ..|
|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 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000710| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 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 |........|........|
|00000780| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000790| 00 00 00 00 00 00 00 00 | 00 1c 00 1e ff ff 00 00 |........|........|
|000007a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+