Help with a program for class...
Class question:
"To perform an addition such as 3+4, two sticks can be placed side-by-side, with the '0' of the upper stick next to the '3' of the lower stick. The result of the computation can then be read off by looking for the number on the lower stick which lines up with the '4' on the upper stick:
Code:
+-------------------+
|0 1 2 3 4 5 6 7 8 9|
+-----+-------------+-----+
|0 1 2 3 4 5 6 7 8 9|
+-------------------+
^
(picture won't work, but the 0 is in line with bottom 3, so the 7 is below the 4(top).)
Stage 1: Addition
Write a C program which reads an integer, a character, and another integer from standard input, and prints to standard output a picture of the corresponding computing stick computation, in the format shown above. Note:
the two integers will be between 1 and 9 (inclusive)
the horizontal and vertical edges of the sticks should be drawn using the characters '-' and '|'
the corners of the sticks should be drawn as '+'
an up-arrow '^' should be printed to point to the result of the computation
your program should not print any tabs; it should only print spaces ' ', and it should not print any additional blank spaces at the end of any line
the order of the numbers is important; the computation for 4+3 should look different from that of 3+4 "
I am getting stuck with the movement of these 'sticks', any tips would be appreciated.