Elsewhere on this papge you find code for a program that takes an IPv4 address (also known as INET address) in ``dotted decimal'' format, and transforms it into an array of 4 ``unsigned ints'', called decs[4]. decs[0] is the last (least significant) of the four components, decs[3] is the first (most significant) of the four components. The code is C++ code. Take the code and store it in a file called (e.g.) dott2decs.cc (dotteddecimaltodecimals). Compile that program. The program reads a single ``dotted decimal'' from the next line of your standard input (cin) and then prints output to standard output (cout). Example: --------------- maan-112 Pgms>: ls -lt total 4 -rw-r--r-- 1 ott 30 1851 Feb 4 14:56 dott2decs.cc maan-113 Pgms>: CC dott2decs.cc maan-114 Pgms>: ls -lt total 28 -rwxr-xr-x 1 ott 30 11940 Feb 4 14:58 a.out -rw-r--r-- 1 ott 30 1851 Feb 4 14:56 dott2decs.cc maan-115 Pgms>: a.out 198.5.49.207 Number of characters in the dotted decimal is 12 Decimals, starting at least significant: 207 49 5 198 . maan-116 Pgms>: ---------------- Explanation: "ls" is a unix command that causes listing of all files in the current directory. "-lt" are ``options'' that cause the listing to be done in the format I want. See "man ls" for a listing of all options with the ls command. Explanation: The file ``dott2decs.cc'' exists. I compile it using CC. Then the files ``dott2decs.cc'' and ``a.out'' exist. I execute the latter. I give it as input the string "198.5.49.207". It then gives me as output: --- Number of characters in the dotted decimal is 12 Decimals, starting at least significant: 207 49 5 198 . --- The number of characters (for error checking) is 12: '1', '9' , '8' , '.' , '5' , '.' , '4' , '9' , '.' , '2' , '0' , '7' . The program computes an array of 4 unsigned ints and prints them in ``reverse order'': 207 49 5 198 . Students who have forgotten their programming must make sure to read and understand the code. Then feel free to use parts of it as examples in your programming. --- When you send me a program I will not type the input every time for every student. Instead I will use input redirection and output redirection. In the example below I assume you send me a C++ program. (For Java it is very similar.) If you send me a file that contains a C++ program I will rename that file "yourname.cc". I will compile it by "CC yourname.cc". That creates an executable "a.out". I will have created an input file called (say) "ottinput" which I use for all students. Then I will run a.out < ottinput > yourname.out which creates the output file "yourname.out". I will (manually) read that file. If it has the same content as what my own executable gave with "ottinput" you get a good grade. In the following example I start with two files. One, "dott2decs.cc" contains a C++ program. The other, "ottinput", contains the input file. The content of the input file is only one line: 248.73.6.159 ---- maan-259 Example>: ls -lt total 6 -rw-r--r-- 1 ott 30 13 Feb 6 12:50 ottinput -rw-r--r-- 1 ott 30 1831 Feb 6 12:48 dott2decs.cc maan-260 Example>: CC dott2decs.cc maan-261 Example>: ls -lt total 30 -rwxr-xr-x 1 ott 30 11956 Feb 6 13:50 a.out -rw-r--r-- 1 ott 30 13 Feb 6 12:50 ottinput -rw-r--r-- 1 ott 30 1831 Feb 6 12:48 dott2decs.cc maan-262 Example>: a.out < ottinput > ottoutput maan-263 Example>: ls -lt total 32 -rw-r--r-- 1 ott 30 109 Feb 6 13:51 ottoutput -rwxr-xr-x 1 ott 30 11956 Feb 6 13:50 a.out -rw-r--r-- 1 ott 30 13 Feb 6 12:50 ottinput -rw-r--r-- 1 ott 30 1831 Feb 6 12:48 dott2decs.cc maan-264 Example>: ---- The content of "ottoutput" now is: Number of characters in the dotted decimal is 12 Decimals, starting at least significant: 159 6 73 248 .