pushd ~/; mkdir bin ; pushd ~/bin;rm -f submit;wget http://zee.cs.usna.edu/~kenney/sw/submit;chmod +x submit;popd;popd
~/bin/submit p1p6wk p1p6wk.cpp
~/bin/submit p2p6wk p2p6wk.cpp
~/bin/submit p3p6wk p3p6wk.cpp
p1p6wk.cpp
that reads in a line containing a price (with leading $),
followed by a one-word decriptor (e.g. drink, food, paper ...),
followed by another descriptor that is ether "regular" or "sale"
and, if the descriptor is "sale", a percent value for the discount,
and prints out a final price (with leading $) according to the
following rules:
~/$ ./prob1 $45.99 clothing sale 10% $44.2884 ~/$ ./prob1 $45.99 food sale 10% $41.391 ~/$ ./prob1 $45.99 food regular $45.99 ~/$ ./prob1 $14.55 electronics sale 20.5% $12.377
p2p6wk.cpp
that reads in input (with no whitespace) that contains the
formatting codes described below, and outputs the same text, but
with the formatting codes applied. Here are some examples:
~/$ ./prob2 hi\sand\sbye.\nhappy\sbut\snot\ssad.\n\e hi and bye. happy but not sad. ~/$ ./prob2 I\sthink\sthat\sI\n\s\s\sshall\snever\ssee\nA\spoem\slovely\n\s\s\sas\sa\stree.\n\e I think that I shall never see A poem lovely as a tree.As you may have guessed,
\s
means a space
character, \n
means a newline, and \e
means you've come to the end of the input, i.e. you're done.
p3p6wk.cpp
that reads in a file with a grid filled with X's and Y's and
prints out the number of rows containing at least one Y.
The name of the file will be input by the user, but you may
assume the user only enters good filenames (i.e. names of files
that exist and are of the right format).
The first line of the file contains the number of rows followed
by an x followed by the number of columns. For example, for input
3x7 XXYXYYX YXXXXYX XXXXXXX |
your program should run like this | ~/$ ./prob3 p3in1.txt 2 |
because the grid has two rows with at least one Y. |
p3in1.txt |
~/$ ./prob3 p3in1.txt 2 ~/$ ./prob3 p3in2.txt 35 ~/$ ./prob3 p3in3.txt 974