diff options
Diffstat (limited to 'usr.bin/learn/lib/C/L5.2e')
-rw-r--r-- | usr.bin/learn/lib/C/L5.2e | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/usr.bin/learn/lib/C/L5.2e b/usr.bin/learn/lib/C/L5.2e new file mode 100644 index 00000000000..987a3cdb127 --- /dev/null +++ b/usr.bin/learn/lib/C/L5.2e @@ -0,0 +1,58 @@ +#print +(Section 1.5) +Write a program which copies its input to its output +doubling each character (i.e. each input character +is written twice on the output). Compile and test +it. Then type ready. Don't forget + + #include <stdio.h> + +at the beginning of your program, and + +cc x.c -lS + +to compile it. +#once #create Ref +hoboken harrison newark roseville avenue grove street +east orange brick church orange highland avenue +mountain station south orange maplewood millburn short hills +summit chatham madison convent station morristown +new providence murray hill berkeley heights +gillette stirling millington lyons basking ridge +bernardsville far hills peapack gladstone +#once #create Answer +hhoobbookkeenn hhaarrrriissoonn nneewwaarrkk rroosseevviillllee aavveennuuee ggrroovvee ssttrreeeett + +eeaasstt oorraannggee bbrriicckk cchhuurrcchh oorraannggee hhiigghhllaanndd aavveennuuee + +mmoouunnttaaiinn ssttaattiioonn ssoouutthh oorraannggee mmaapplleewwoooodd mmiillllbbuurrnn sshhoorrtt hhiillllss + +ssuummmmiitt cchhaatthhaamm mmaaddiissoonn ccoonnvveenntt ssttaattiioonn mmoorrrriissttoowwnn + +nneeww pprroovviiddeennccee mmuurrrraayy hhiillll bbeerrkkeelleeyy hheeiigghhttss + +ggiilllleettttee ssttiirrlliinngg mmiilllliinnggttoonn llyyoonnss bbaasskkiinngg rriiddggee + +bbeerrnnaarrddssvviillllee ffaarr hhiillllss ppeeaappaacckk ggllaaddssttoonnee + +#user +a.out <Ref >xxx +#cmp Answer xxx +#succeed +/* One way: */ + + #include <stdio.h> + +main() +{ + int c; + + while ((c = getchar()) != EOF) { + putchar(c); + putchar(c); + } +} +#log +#next +5.1e 5 +5.3e 2 |