Swap the Alphabet
C, 59 bytes
Sorry for bringing up C again, but I was a bit disappointed to see only C functions here. I was under the impression OP was looking for a usable product.
main(c){while(~(c=getchar()))putchar(isalpha(c)?c+4^31:c);}
Compiled on Ubuntu 14.04 with a simple:
cc swalpha.c
The resulting executable reads any number of lines from stdin, and writes the result to stdout.
Thanks to so many of the other posters for the XOR trick.
JavaScript (ES6), 69 67 bytes
x=>x.replace(/[A-Z]/gi,c=>String.fromCharCode(c.charCodeAt()+4^31))
Uses the same strategy as my Japt answer:
x=>x.replace(/[A-Z]/gi,C=> // Replace each letter C with
String.fromCharCode( // the character with char code
C.charCodeAt()+4^31)) // the char code of C, plus 4, with the last 5 bits flipped.
Curse your incredibly long property names, JS...
CJam, 17 bytes
I wanted to help GamrCorps golf his CJam solution, but the result ended up so different that I decided to make a separate answer.
q'[,_el^_W%32f^er
Try it online.
Explanation
q e# Read all input.
'[, e# Get a character range from the null byte up to and including "Z".
_el e# Duplicate and convert to lowercase.
^ e# Symmetric set difference. Due to the lowercase operation only letters will not
e# appear in both sets, and so we get a string with all uppercase letters followed
e# by all lowercase letters, i.e "ABC...XYZabc...xyz".
_W% e# Duplicate and reverse. Gives: "zyx...cbaZYX...CBA".
32f^ e# Take each character XOR 32 which swaps the case, so now we have:
e# "ZYX...CBAzyx...cba"
er e# Transliterate: substitute each character in the first string with the correspoding
e# character in the second string.