modified beads.cpp
finish beads.cpp