Home » Archimedes archive » Archimedes World » AW-1991-10.adf » October91 » !AWOct91/Goodies/AllAtC/work/c/words
!AWOct91/Goodies/AllAtC/work/c/words
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Archimedes World » AW-1991-10.adf » October91 |
Filename: | !AWOct91/Goodies/AllAtC/work/c/words |
Read OK: | ✔ |
File size: | 0271 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
/* Program: !Words */ /* Archimedes World, October 1991. */ #include "lexical.h" #include <stdio.h> int main( void ) { int count = 0; word list = NULL; string buffer; puts( "Please enter a list of words:- " ); while ( TRUE ) { printf( "Word %i: ", ++count ); GetWord( buffer, STRLEN, stdin ); if ( *buffer ) { ToLowerCase( buffer ); StoreWord( buffer, &list ); } else break; } puts( "\nWords in sorted order:-\n" ); ListWords( list ); return 0; }
00000000 2f 2a 20 20 50 72 6f 67 72 61 6d 3a 20 21 57 6f |/* Program: !Wo| 00000010 72 64 73 20 20 20 20 20 20 20 20 20 20 20 20 20 |rds | 00000020 20 20 20 20 20 20 20 20 20 20 2a 2f 0a 2f 2a 20 | */./* | 00000030 20 41 72 63 68 69 6d 65 64 65 73 20 57 6f 72 6c | Archimedes Worl| 00000040 64 2c 20 4f 63 74 6f 62 65 72 20 31 39 39 31 2e |d, October 1991.| 00000050 20 20 20 20 20 20 20 2a 2f 0a 0a 23 69 6e 63 6c | */..#incl| 00000060 75 64 65 20 22 6c 65 78 69 63 61 6c 2e 68 22 0a |ude "lexical.h".| 00000070 23 69 6e 63 6c 75 64 65 20 3c 73 74 64 69 6f 2e |#include <stdio.| 00000080 68 3e 0a 0a 69 6e 74 20 6d 61 69 6e 28 20 76 6f |h>..int main( vo| 00000090 69 64 20 29 0a 7b 0a 20 20 20 20 69 6e 74 20 20 |id ).{. int | 000000a0 63 6f 75 6e 74 20 3d 20 30 3b 0a 20 20 20 20 77 |count = 0;. w| 000000b0 6f 72 64 20 20 6c 69 73 74 20 3d 20 4e 55 4c 4c |ord list = NULL| 000000c0 3b 0a 20 20 20 20 73 74 72 69 6e 67 20 62 75 66 |;. string buf| 000000d0 66 65 72 3b 0a 0a 20 20 20 20 70 75 74 73 28 20 |fer;.. puts( | 000000e0 22 50 6c 65 61 73 65 20 65 6e 74 65 72 20 61 20 |"Please enter a | 000000f0 6c 69 73 74 20 6f 66 20 77 6f 72 64 73 3a 2d 20 |list of words:- | 00000100 22 20 29 3b 0a 0a 20 20 20 20 77 68 69 6c 65 20 |" );.. while | 00000110 28 20 54 52 55 45 20 29 0a 20 20 20 20 7b 0a 20 |( TRUE ). {. | 00000120 20 20 20 20 20 20 20 70 72 69 6e 74 66 28 20 22 | printf( "| 00000130 57 6f 72 64 20 25 69 3a 20 22 2c 20 2b 2b 63 6f |Word %i: ", ++co| 00000140 75 6e 74 20 29 3b 0a 0a 20 20 20 20 20 20 20 20 |unt );.. | 00000150 47 65 74 57 6f 72 64 28 20 62 75 66 66 65 72 2c |GetWord( buffer,| 00000160 20 53 54 52 4c 45 4e 2c 20 73 74 64 69 6e 20 29 | STRLEN, stdin )| 00000170 3b 0a 0a 20 20 20 20 20 20 20 20 69 66 20 28 20 |;.. if ( | 00000180 2a 62 75 66 66 65 72 20 29 0a 20 20 20 20 20 20 |*buffer ). | 00000190 20 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 | {. | 000001a0 54 6f 4c 6f 77 65 72 43 61 73 65 28 20 62 75 66 |ToLowerCase( buf| 000001b0 66 65 72 20 29 3b 0a 0a 20 20 20 20 20 20 20 20 |fer );.. | 000001c0 20 20 20 20 53 74 6f 72 65 57 6f 72 64 28 20 62 | StoreWord( b| 000001d0 75 66 66 65 72 2c 20 26 6c 69 73 74 20 29 3b 0a |uffer, &list );.| 000001e0 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 | }. | 000001f0 20 20 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 | else. | 00000200 20 20 20 62 72 65 61 6b 3b 0a 20 20 20 20 7d 0a | break;. }.| 00000210 0a 20 20 20 20 70 75 74 73 28 20 22 5c 6e 57 6f |. puts( "\nWo| 00000220 72 64 73 20 69 6e 20 73 6f 72 74 65 64 20 6f 72 |rds in sorted or| 00000230 64 65 72 3a 2d 5c 6e 22 20 29 3b 0a 0a 20 20 20 |der:-\n" );.. | 00000240 20 4c 69 73 74 57 6f 72 64 73 28 20 6c 69 73 74 | ListWords( list| 00000250 20 29 3b 0a 20 20 20 20 20 20 20 20 0a 20 20 20 | );. . | 00000260 20 72 65 74 75 72 6e 20 30 3b 0a 7d 0a 0a 0a 0a | return 0;.}....| 00000270 0a |.| 00000271