1. std::endl flushes(i.e forces output) the output buffer while just putting '\n' doesn't.

2. Declare name as std::string instead of char, which is for a single character.