Output digits of a number
Please stop using using namespace std. Read
this
Consider using a std::vector to hold the digits of a number. Here
it seems as though you can assume the user is inputting a number
with four digits. But that might not always be the case. A vector is
dynamic.
 This is...uh, well:

first = base / 1000;
second = base / 100 % 10;
third =  base / 10 % 10;
fourth = base % 10;


Consider using a while loop to get all digits of the number.

while(number)
{
    digits.push_back(number%10);
    number /= 10;
}


Note the digits will be in reverse. You can use std::reverse() to
reverse the digits such that the first element in the vector is the
first digit of the number.
Use std::accumulate() to obtain the sum of all digits. You don't
have to do this in the while loop.


Here is everything together. Ideally, you would want to put the while loop and summing operation in another function.

#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;algorithm&gt;

using std::cout;
using std::cin;
using std::endl;
using std::vector;



int main()
{
    int number, sum;
    vector&lt;int&gt; digits;

    cout &lt;&lt; "Enter a whole number: ";
    cin &gt;&gt; number;

    while(number)
    {
        digits.push_back(number%10);
        number /= 10;
    }


    std::reverse(digits.begin(),digits.end());
    sum = std::accumulate(digits.begin(),digits.end(),0);

    //C++11 range-based for loop
    for(auto i : digits)
        cout &lt;&lt; i &lt;&lt; " ";

    cout &lt;&lt; "\nSum of the digits: ";
    cout &lt;&lt; sum &lt;&lt; endl;

}