
May 27, 2011, 06:27:02 AM 

Im feeling generous, so I'll bite if you are still doing this. Below are four programming problems that each introduce a crucial programming concept (Recursion, file I/O, binary numbers, string manipulation, and sorting). I tried to put them in the order of what I consider to be easiest to hardest, but you may disagree with the order (You dont have to do them in order or even do all of them) For every problem, put the source code and a compiled executable (the .exe file) up for download and send me a link. I will give you .15 BTC for each problem where I am satisfied with your solution. If you get a perfect solution for all 4 problems, Ill give you an extra .15 BTC for a total of .75 BTC.
1. Ask the user for an input positive integer x. Without using loops or goto statements (look up recursion), print "RECURSION!" x times.
Sample run:
Input: 4 RECURSION! RECURSION! RECURSION! RECURSION!
2. Ask the user to input "D" or "B". If the input is "D", ask the user to input a positive integer in in base10 (Decimal) and output it as a binary. If the input is "B", ask the user to input a positive integer in base2 (Binary) and output it as a decimal. Assume all inputs are valid (don't error check)
For example consider the number Four. Four is 4 in base10 (Decimal) and 100 in base2 (Binary)
Sample run #1:
Type: D Input: 4 Output: 100
Sample run #2:
Type: B Input: 100 Output: 4
3. Ask the user to input "C" or "D", then, a filename/path to read for input, and a filename/path for output. If the user put "C" (for "Compress"), compress the file using RunLength compression. If the user put "D", decompress the file using RunLength compression. In both cases, output the result to the filename/path the user provided for output.
RunLength compression is easy to understand. Consider a textfile that just has "AAABB". That will compress to something like 3A2B. Essentially, "3A2B" says 3 A's and 2 B's, or "AAABB". More examples:
Uncompressed > Compressed AAAAA > 5A ABCDE > 1A1B1C1D1E AABBA > 2A2B1A
4. Ask the user for an input (Assume the input is always an integer. No need to error check the input). Continue asking for input until the user types "end" (case insensitive). Assume all inputs are valid (integer or "end" (case insensitive)). After the user types "end", sort the integers and output the result. No using library functions for sorting! :]
Sample run:
Input: 7 Input: 14 Input: 2 Input: eND Result: 2, 7, 14
You can use C++ or C#, I don't care. Good luck!
