add sudo user ubuntu

C++
usermod -aG sudo username# add a user and set a password
adduser USERNAME

# add user to sudoers / sudo groupe with command below
usermod -aG sudo USERNAME
echo "username  ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/username
Source

Also in C++: