结果里莫名出现的0是哪里来的

问题遇到的现象和发生背景

要求是:冒泡排序,输出每次排序的结果

问题相关代码,请勿粘贴截图
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
template<class ElemType>
void BubbleSort( vector<ElemType> &A )
{int len=A.size();
    int m=A.size()-1;
    int flag=1;
    while((m>0)&&(flag==1))
    {
        flag=0;
        for(int j=0;j<=m;j++)
        {
            if(A[j]>A[j+1])
               {
                  flag=1;
                 ElemType num=A[j];
                A[j]=A[j+1];
                A[j+1]=num ;
               }
        }
        --m;
        for(int i=0;i<len-1;i++)
            cout<<A[i]<<",";
            cout<<A[len-1];
            cout<<endl;
    }
}
int main ()
{vector<int> putint;
vector<double>putdouble;
vector<char>putchar;
vector<string>putstring;
    int choice;
    cin>>choice;
    if(choice!=0&&choice!=1&&choice!=2&&choice!=3)
        cout<<"err";
   if(choice==0)
{
    int elemint;
    while(cin>>elemint)
      {
          putint.push_back(elemint);
            if(getchar()=='\n')
            break;
      }
}
if(choice==1)
{
    double elemdou;
    while(cin>>elemdou)
    {
        putdouble.push_back(elemdou);
          if(getchar()=='\n')
            break;
    }
}
if(choice==2)
{
    char elemch;
    while(cin>>elemch)
    {
        putchar.push_back(elemch);
          if(getchar()=='\n')
            break;
    }
}
if(choice==3)
{
    string elemstr;
    while(cin>>elemstr)
    {
        putstring.push_back(elemstr);
          if(getchar()=='\n')
            break;
    }
}
if(choice==0)
    BubbleSort(putint);
if(choice==1)
    BubbleSort(putdouble);
if(choice==2)
    BubbleSort(putchar);
if(choice==3)
   BubbleSort(putstring);

}


运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果