Encode the problem using a binary string, and also use recursion.
Suppose n = 6. Then have a six digit binary string, modeled by a six entry boolean array. Then 000000 means all six people are in the first room, 111111 means all six are in the second room. For persons A, C, and D to be in the first room, while B, E, F are in the second, is 010011.
It's 51 lines of code. Of course, I could delete four sets of parenthesis and get it down to 43 lines of code.
 Enter number of people: 4

 abcd

d abc

c abd

cd ab

b acd

bd ac

bc ad

bcd a

a bcd

ad bc

ac bd

acd b

ab cd

abd c

abc d

abcd 

Press any key to continue . . .