In the following program, when I enter a number I'M getting strange output back. When I enter 5 I get 0x6011a85 back on the cout << "you entered" line.

#include <iostream>
//#include "functions.h"

int main()
{
    std::cout << "Please enter a number. " << std::endl;
    int date = 0;
    std::cin >> date;
    std::cout << "You entered" << std::cout << date;
}

// FUNCTIONS

/*int getNrDigits( int my_int )
{
    int local_int = my_int;
    int count = 0;

    while ( local_int > 0 )
    {
        local_int /= 10;
        count++
    }
    return count;
} */

line 9 should be

 std::cout << "You entered" << date;

You only need to call cout once.

std::cout << "You entered" << std::cout << date;

There is the problem. Try:

std::cout << "You entered" << date;

(without the second cout)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.