I know there is a bug in the code, but I am interested to know exactly how C++14 processes the code to output this
3
þÿÿt
With this code
#include <iostream>
void pretty_print(int,int,int);
int main()
{
    srand(time(0));
    const int LIM = 100;
    int a = rand()%LIM;
    int b = rand()%LIM;
    int c = rand()%LIM;
    if(a+b+c<500)
    {
        pretty_print(a,b,c);
    }
    else throw new std::invalid_argument("FOOBAR");
    return 0;
}
void pretty_print(int a, int b,int c)
{
    std::string ans = "";
    int count = 0;
    if(a!=0)
    {
        count++;
        ans+=(a+" ");
    }
    if(b!=0)
    {
        count++;
        ans+=(b+" ");
    }
    if(c!=0)
    {
        count++;
        ans+=(c+" ");
    }
    std::cout << count << "\n";
    std::cout << ans << "\n";
}
P.S. I have deliberately tried to add an integer to a string without conversion in order to examine why the output is such. I want to know why adding an integer without conversion to a string results in such a behaviour.
 
     
    