Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- bool iste_cifre(int broj)
- {
- std::vector<int> brojaci(10);
- int a(broj);
- while(a > 0)
- {
- brojaci[a%10]++;
- a/=10;
- }
- for(int i(0); i < brojaci.size(); i++)
- {
- if(brojaci[i] > 1)
- return true;
- }
- return false;
- }
- int main()
- {
- int n;
- std::cout << "Unesite neki broj: " << std::endl;
- std::cin >> n;
- if(iste_cifre(n))
- std::cout << "Broj ima istih cifara!" << std::endl;
- else
- std::cout << "Broj nema istih cifara!" << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment