ubuntu see if package is installed

C++
dpkg -l {package_name}
Source

Also in C++: