_int128输出挂

转载:http://wangmingxuan.cn/?post=56

std::ostream& operator<<(std::ostream& os, __int128 t) {
    if (t==0) return os << "0";
    if (t<0) {
        os<<"-";
        t=-t;
    }
    int a[50],ai=0;
    memset(a,0,sizeof a);
    while (t!=0){
        a[ai++]=t%10;
        t/=10;
    }
    for (int i=1;i<=ai;i++) os<=10 ) os<0 ? (int) (T%10) : -(int) (T%10) ) ;
}


你可能感兴趣的:(模板)