Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

C++ convert vector of digits into integer

// Convert vector of digits to integer
long long vector_to_int(vector<int> num) { 
    long long n = 0;
    int N = num.size();
    for (int i = 0; i < N; i++) {
        n += num[i]*pow(10, N-i-1);
    }
    return n;
}
 
PREVIOUS NEXT
Tagged: #convert #vector #digits #integer
ADD COMMENT
Topic
Name
9+7 =