Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdexcept>
- #include <complex>
- #include<vector>
- bool Funkcija(int broj)
- {
- if (broj < 0)
- {
- throw std::domain_error("Pogresan argument");
- }
- std::vector<int>v;
- while(broj >0)
- {
- v.push_back(broj%10);
- broj/=10;
- }
- for (int i(0); i<v.size()-1; i++)
- {
- if (v[i]==v[i+1])
- return true;
- }
- return false;
- }
- int main()
- {
- int n;
- std::cout<<"Unesi broj: \n";
- std::cin>>n;
- std::cout<< Funkcija(n);
- }
Advertisement
Add Comment
Please, Sign In to add comment