home *** CD-ROM | disk | FTP | other *** search
/ Sams Teach Yourself C in 21 Days (6th Edition) / STYC216E.ISO / mac / Examples / Day24 / base.cpp < prev    next >
MacBinary  |  2002-05-25  |  1.8 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
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Sat May 25 13:17:20 2002, modified Sat May 25 13:17:20 2002, creator 'LMAN', type ASCII, 1156 bytes "base.cpp" , at 0x504 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 62 61 73 65 2e 63 | 70 70 00 00 00 00 00 00 |..base.c|pp......|
|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 04 84 00 | 00 01 1e b9 15 77 a0 b9 |........|.....w..|
|00000060| 15 77 a0 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.w......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 6c f4 00 00 |........|....l...|
|00000080| 23 69 6e 63 6c 75 64 65 | 20 3c 69 6f 73 74 72 65 |#include| <iostre|
|00000090| 61 6d 2e 68 3e 0d 0a 23 | 69 6e 63 6c 75 64 65 20 |am.h>..#|include |
|000000a0| 3c 73 74 72 69 6e 67 2e | 68 3e 0d 0a 0d 0a 23 64 |<string.|h>....#d|
|000000b0| 65 66 69 6e 65 20 4d 41 | 58 5f 4c 45 4e 20 38 31 |efine MA|X_LEN 81|
|000000c0| 0d 0a 0d 0a 63 6c 61 73 | 73 20 70 65 72 73 6f 6e |....clas|s person|
|000000d0| 20 7b 0d 0a 70 72 6f 74 | 65 63 74 65 64 3a 0d 0a | {..prot|ected:..|
|000000e0| 20 20 20 20 63 68 61 72 | 20 66 6e 61 6d 65 5b 4d | char| fname[M|
|000000f0| 41 58 5f 4c 45 4e 5d 3b | 0d 0a 20 20 20 20 63 68 |AX_LEN];|.. ch|
|00000100| 61 72 20 6c 6e 61 6d 65 | 5b 4d 41 58 5f 4c 45 4e |ar lname|[MAX_LEN|
|00000110| 5d 3b 0d 0a 20 20 20 20 | 69 6e 74 20 20 61 67 65 |];.. |int age|
|00000120| 3b 0d 0a 70 75 62 6c 69 | 63 3a 0d 0a 20 20 20 20 |;..publi|c:.. |
|00000130| 76 6f 69 64 20 73 65 74 | 5f 66 6e 61 6d 65 28 63 |void set|_fname(c|
|00000140| 68 61 72 20 66 6e 5b 5d | 20 29 20 7b 20 73 74 72 |har fn[]| ) { str|
|00000150| 63 70 79 28 66 6e 61 6d | 65 2c 20 66 6e 29 3b 20 |cpy(fnam|e, fn); |
|00000160| 7d 3b 0d 0a 20 20 20 20 | 76 6f 69 64 20 73 65 74 |};.. |void set|
|00000170| 5f 6c 6e 61 6d 65 28 63 | 68 61 72 20 6c 6e 5b 5d |_lname(c|har ln[]|
|00000180| 20 29 20 7b 20 73 74 72 | 63 70 79 28 6c 6e 61 6d | ) { str|cpy(lnam|
|00000190| 65 2c 20 6c 6e 29 3b 20 | 7d 3b 0d 0a 20 20 20 20 |e, ln); |};.. |
|000001a0| 76 6f 69 64 20 73 65 74 | 5f 61 67 65 28 20 69 6e |void set|_age( in|
|000001b0| 74 20 61 20 29 20 7b 20 | 61 67 65 20 3d 20 61 20 |t a ) { |age = a |
|000001c0| 3b 20 7d 3b 0d 0a 20 20 | 20 20 63 68 61 72 20 2a |; };.. | char *|
|000001d0| 67 65 74 5f 6e 61 6d 65 | 28 63 68 61 72 20 2a 66 |get_name|(char *f|
|000001e0| 75 6c 6c 6e 61 6d 65 29 | 3b 0d 0a 20 20 20 20 69 |ullname)|;.. i|
|000001f0| 6e 74 20 20 67 65 74 5f | 61 67 65 28 20 76 6f 69 |nt get_|age( voi|
|00000200| 64 20 29 20 7b 20 72 65 | 74 75 72 6e 20 61 67 65 |d ) { re|turn age|
|00000210| 3b 20 7d 3b 0d 0a 20 20 | 20 20 70 65 72 73 6f 6e |; };.. | person|
|00000220| 28 63 68 61 72 20 66 6e | 5b 5d 20 3d 20 22 62 6c |(char fn|[] = "bl|
|00000230| 61 6e 6b 22 2c 20 63 68 | 61 72 20 6c 6e 5b 5d 20 |ank", ch|ar ln[] |
|00000240| 3d 20 22 62 6c 61 6e 6b | 22 29 3b 0d 0a 7d 3b 0d |= "blank|");..};.|
|00000250| 0a 0d 0a 70 65 72 73 6f | 6e 3a 3a 70 65 72 73 6f |...perso|n::perso|
|00000260| 6e 28 20 63 68 61 72 20 | 66 6e 5b 5d 2c 20 63 68 |n( char |fn[], ch|
|00000270| 61 72 20 6c 6e 5b 5d 20 | 29 0d 0a 7b 0d 0a 20 20 |ar ln[] |)..{.. |
|00000280| 20 20 73 74 72 63 70 79 | 28 66 6e 61 6d 65 2c 20 | strcpy|(fname, |
|00000290| 66 6e 29 3b 0d 0a 20 20 | 20 20 73 74 72 63 70 79 |fn);.. | strcpy|
|000002a0| 28 6c 6e 61 6d 65 2c 20 | 6c 6e 29 3b 0d 0a 20 20 |(lname, |ln);.. |
|000002b0| 20 20 61 67 65 20 3d 20 | 2d 31 3b 0d 0a 7d 0d 0a | age = |-1;..}..|
|000002c0| 0d 0a 63 68 61 72 20 2a | 70 65 72 73 6f 6e 3a 3a |..char *|person::|
|000002d0| 67 65 74 5f 6e 61 6d 65 | 28 63 68 61 72 20 66 75 |get_name|(char fu|
|000002e0| 6c 6c 6e 61 6d 65 5b 5d | 29 0d 0a 7b 0d 0a 20 20 |llname[]|)..{.. |
|000002f0| 20 20 73 74 72 63 70 79 | 28 66 75 6c 6c 6e 61 6d | strcpy|(fullnam|
|00000300| 65 2c 20 66 6e 61 6d 65 | 29 3b 0d 0a 20 20 20 20 |e, fname|);.. |
|00000310| 73 74 72 63 61 74 28 66 | 75 6c 6c 6e 61 6d 65 2c |strcat(f|ullname,|
|00000320| 20 22 20 22 29 3b 0d 0a | 20 20 20 20 73 74 72 63 | " ");..| strc|
|00000330| 61 74 28 66 75 6c 6c 6e | 61 6d 65 2c 20 6c 6e 61 |at(fulln|ame, lna|
|00000340| 6d 65 29 3b 0d 0a 0d 0a | 20 20 20 20 72 65 74 75 |me);....| retu|
|00000350| 72 6e 20 66 75 6c 6c 6e | 61 6d 65 3b 0d 0a 7d 0d |rn fulln|ame;..}.|
|00000360| 0a 0d 0a 69 6e 74 20 6d | 61 69 6e 28 69 6e 74 20 |...int m|ain(int |
|00000370| 61 72 67 63 2c 20 63 68 | 61 72 2a 20 61 72 67 76 |argc, ch|ar* argv|
|00000380| 5b 5d 29 0d 0a 7b 0d 0a | 20 20 20 20 63 68 61 72 |[])..{..| char|
|00000390| 20 66 75 6c 6c 5b 4d 41 | 58 5f 4c 45 4e 20 2b 20 | full[MA|X_LEN + |
|000003a0| 4d 41 58 5f 4c 45 4e 5d | 3b 0d 0a 0d 0a 20 20 20 |MAX_LEN]|;.... |
|000003b0| 20 70 65 72 73 6f 6e 20 | 62 72 61 64 28 22 42 72 | person |brad("Br|
|000003c0| 61 64 6c 65 79 22 2c 20 | 22 4a 6f 6e 65 73 22 29 |adley", |"Jones")|
|000003d0| 3b 0d 0a 20 20 20 20 62 | 72 61 64 2e 73 65 74 5f |;.. b|rad.set_|
|000003e0| 61 67 65 28 32 31 29 3b | 0d 0a 0d 0a 20 20 20 20 |age(21);|.... |
|000003f0| 70 65 72 73 6f 6e 20 62 | 6c 61 6e 6b 3b 0d 0a 0d |person b|lank;...|
|00000400| 0a 20 20 20 20 63 6f 75 | 74 20 3c 3c 20 22 5c 6e |. cou|t << "\n|
|00000410| 50 65 72 73 6f 6e 20 62 | 72 61 64 3a 20 20 22 20 |Person b|rad: " |
|00000420| 3c 3c 20 62 72 61 64 2e | 67 65 74 5f 6e 61 6d 65 |<< brad.|get_name|
|00000430| 28 66 75 6c 6c 29 3b 0d | 0a 20 20 20 20 63 6f 75 |(full);.|. cou|
|00000440| 74 20 3c 3c 20 22 5c 6e | 20 20 20 20 20 20 20 20 |t << "\n| |
|00000450| 61 67 65 3a 20 20 22 20 | 3c 3c 20 62 72 61 64 2e |age: " |<< brad.|
|00000460| 67 65 74 5f 61 67 65 28 | 29 3b 0d 0a 0d 0a 20 20 |get_age(|);.... |
|00000470| 20 20 63 6f 75 74 20 3c | 3c 20 22 5c 6e 50 65 72 | cout <|< "\nPer|
|00000480| 73 6f 6e 20 62 6c 61 6e | 6b 3a 20 22 20 3c 3c 20 |son blan|k: " << |
|00000490| 62 6c 61 6e 6b 2e 67 65 | 74 5f 6e 61 6d 65 28 66 |blank.ge|t_name(f|
|000004a0| 75 6c 6c 29 3b 0d 0a 20 | 20 20 20 63 6f 75 74 20 |ull);.. | cout |
|000004b0| 3c 3c 20 22 5c 6e 20 20 | 20 20 20 20 20 20 20 61 |<< "\n | a|
|000004c0| 67 65 3a 20 22 20 3c 3c | 20 62 6c 61 6e 6b 2e 67 |ge: " <<| blank.g|
|000004d0| 65 74 5f 61 67 65 28 29 | 3b 0d 0a 20 20 20 20 63 |et_age()|;.. c|
|000004e0| 6f 75 74 20 3c 3c 20 22 | 5c 6e 22 3b 0d 0a 0d 0a |out << "|\n";....|
|000004f0| 20 20 20 20 72 65 74 75 | 72 6e 20 30 3b 0d 0a 7d | retu|rn 0;..}|
|00000500| 0d 0a 0d 0a 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000510| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000520| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000580| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000590| 54 68 69 73 20 72 65 73 | 6f 75 72 63 65 20 66 6f |This res|ource fo|
|000005a0| 72 6b 20 69 6e 74 65 6e | 74 69 6f 6e 61 6c 6c 79 |rk inten|tionally|
|000005b0| 20 6c 65 66 74 20 62 6c | 61 6e 6b 20 20 20 00 00 | left bl|ank ..|
|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 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000610| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000620| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000630| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|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 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000690| 00 00 00 00 00 00 00 00 | 00 1c 00 1e ff ff 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 |........|........|
+--------+-------------------------+-------------------------+--------+--------+