#!/bin/sh # This is a shar archive. # The rest of this file is a shell script which will extract: # # 8_1.c 8_1.cmp 8_1.in 8_1a.c 8_1b.c 8_1c.c 8_1c.cmp makefile # # To extract the files from this shell archive file simply # create a directory for this file, move the archive file # to it and enter the command # # sh filename # # The files will be extracted automatically. # Note: Do not use csh. # # Archive created: Mon Jul 30 23:14:33 EDT 1990 # echo x - 8_1.c sed 's/^X//' > 8_1.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ #include "8_1a.c" // DELETE main(int, char**) { while (cin) { double a, b; cin >> a >> b; complex c(a,b); cout << c; } return 0; } !EOF! ls -l 8_1.c echo x - 8_1.cmp sed 's/^X//' > 8_1.cmp << '!EOF!' !EOF! ls -l 8_1.cmp echo x - 8_1.in sed 's/^X//' > 8_1.in << '!EOF!' 8.5 14.34 15.22 -32.57 233.748 32.991 -123456 823.88 !EOF! ls -l 8_1.in echo x - 8_1a.c sed 's/^X//' > 8_1a.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ #include #include !EOF! ls -l 8_1a.c echo x - 8_1b.c sed 's/^X//' > 8_1b.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ cout << complex(a,b); !EOF! ls -l 8_1b.c echo x - 8_1c.c sed 's/^X//' > 8_1c.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ #include "8_1a.c" // EXPAND #include main(int, char**) { for (;;) { double a, b; if (!(cin >> a >> b)) break; complex c(a,b); if (!(cout << c)) break; } if (!cin.eof()) error("error reading input"); if (cout.bad()) error("error writing output"); return 0; } !EOF! ls -l 8_1c.c echo x - 8_1c.cmp sed 's/^X//' > 8_1c.cmp << '!EOF!' !EOF! ls -l 8_1c.cmp echo x - makefile sed 's/^X//' > makefile << '!EOF!' CC= CC -I. -I../../CC ERROR= ../../error.o all: 8_1 8_1c 8_1: 8_1a.c 8_1.c $(CC) 8_1.c -o 8_1 $(ERROR) 8_1c: 8_1c.c 8_1a.c $(CC) 8_1c.c -o 8_1c $(ERROR) CMP= 8_1.cmp 8_1c.cmp OUT= 8_1.out 8_1c.out IN= 8_1.in 8_1.out: 8_1 8_1.in ; 8_1 < 8_1.in > 8_1.out 8_1c.out: 8_1c 8_1.in ; 8_1c < 8_1.in > 8_1c.out test: $(CMP) $(OUT) cmp 8_1.out 8_1.cmp cmp 8_1c.out 8_1c.cmp @echo test done !EOF! ls -l makefile # The following exit is to ensure that extra garbage # after the end of the shar file will be ignored. exit 0