int countOdds(int low, int high) {
int count = 0;
std::vector<int>temp{high-low+1,0};
int n = low;
std::generate(temp.begin(),temp.end(),[&]{return n++;});
for (auto x:temp) {
std::cout << x;
}
}
使用Itoa
int countOdds(int low, int high) {
int count = 0;
std::vector<int>temp(high-low+1);
std::iota(temp.begin(),temp.end(),low);
for (auto x:temp) {
std::cout << x;
}
return 0;
}