So I just encountered a very interesting problem, and came up with a likewise very interesting solution. Recently, my family has made the switch from everyone getting gifts for everyone for Christmas to each person getting gifts for a single person assigned to them. I volunteered to make a JavaScript auto-assigner that will randomly assign one person to each of us and then privately email each of us with the person that we have been assigned.
(Finished in only 589 lines of code, not including another 420 lines of test code!)
*** View this blog with HTTP instead of HTTPS to see the code formatted nicely. ***
Showing posts with label loop. Show all posts
Showing posts with label loop. Show all posts
Monday, November 20, 2017
Christmas Assigner Problem
Labels:
algorithm,
array,
assigner,
calculator,
Christmas,
computation,
efficiency,
email,
exchange,
for,
gift,
HTML,
JavaScript,
loop,
object,
script,
SMTP,
SMTP2Go,
some
Monday, January 28, 2013
Character Arrays in C++
This tutorial will show you how to use char (character) arrays in c++. In case you don't know, in the coding world there are strings of text, e.g.:
"Hello world!"
and these strings can be divided into arrays of characters:
'H' + 'e' + 'l' + 'l' + 'o' + ' ' + 'w' + 'o' + 'r' + 'l' + 'd' + '!'
Each character within a string, file, network packet, or etc. can easily be accessed individually if you use a character array:
charArray[0] == 'H'
charArray[1] == 'e'
etc...
In this tutorial, we will be making a program that will read an input file (which is expected to be a series of phone numbers separated by commas), go through each character in the file and make some changes, and then output the result to another file.
"Hello world!"
and these strings can be divided into arrays of characters:
'H' + 'e' + 'l' + 'l' + 'o' + ' ' + 'w' + 'o' + 'r' + 'l' + 'd' + '!'
Each character within a string, file, network packet, or etc. can easily be accessed individually if you use a character array:
charArray[0] == 'H'
charArray[1] == 'e'
etc...
In this tutorial, we will be making a program that will read an input file (which is expected to be a series of phone numbers separated by commas), go through each character in the file and make some changes, and then output the result to another file.
Subscribe to:
Posts (Atom)