Increment Numbers


I want to increment a number prefixed with a zero. i.e. 0300453. I want to make a series of the number like 0300454, 0300455. The problem is, I can’t retain 0 on the start of new number produced. Anyone can help please??
Make it more clear man.
0300454 this is not a number it is string. Here are no number starting from 0. If it is not 0.300454.
And if it a string you can do
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <string>
#include <iostream>
#include <sstream>

int main() {
	int number = 300454;
	std::string s;
	std::stringstream out;
	out << number;
	s = out.str();
	s.insert(0, "0");
	std::cout << s << std::endl;
	return 0;
}
Last edited on
Topic archived. No new replies allowed.