how to remove user from the group

C++
gpasswd -d user group

# or
usermod -R group user_name
Source

Also in C++: