Given a range of numbers between a and b, I need to find all numbers that have repeating digits. They don't have to be consecutive repeating digits- for example 121 would count as one of these numbers. I already coded the input of the vector list itself - I just don't know how to analyze the digits of each individual item in that vector.
#include <iostream> #include <vector> using namespace std; int main(){ //variables int a, b, i = 0; // a & b inputs, i for iterating //entering number range cout << "Enter the first number" << endl; cin >> a; cout << "Enter the second number" << endl; cin >> b; //making a vector to contain numbers between a and b vector<int> listofnums((b-a)+1); int initialvalue = a; while (i <= (b-a)) { listofnums[i] = initialvalue; initialvalue++; i++; } //printing the completed vector for ( const auto &item : listofnums ){ std::cout << item << ' '; } std::cout << '\n'; //analyzing the digits of each item in the vector //code for finding repeating digits here return 0; }