Automatically answer 'Yes' when using apt-get install

C++
apt-get -y install [packagename]

Source

Also in C++: