Advertisement
sellmmaahh

popravni-2013-zad3

Jul 28th, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. bool Fja (int n)
  6.  {   if (n<=0) throw "N mora biti pozitivno! ";
  7.  
  8.     vector<int> pom(0);
  9.     while (n!=0) {
  10.         pom.push_back(n%10);
  11.         n/=10;
  12.     }
  13.     for (int i=0; i<pom.size()-1;i++) {
  14.         for (int j=i+1; j<pom.size(); j++)
  15.     {
  16.         if (pom[i]==pom[j]) return true;
  17.     } }
  18.     return false;
  19. }
  20.  
  21. int main () {
  22. int n{345699};
  23. try {
  24. bool rez=Fja(n);
  25. cout<<rez;
  26. }
  27. catch (const char por[])
  28. {
  29.     cout<<por;
  30. }
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement