Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Split a number and store it in vector

#include <bits/stdc++.h>
using namespace std;
main() {
	int n = 1213456;
	vector<int> v;
	for(; n; n/=10)
  		v.push_back( n%10 );
	reverse(v.begin(), v.end());
	for (auto &i : v) cout<<i;
}
 
PREVIOUS NEXT
Tagged: #Split #number #store #vector
ADD COMMENT
Topic
Name
5+2 =