Advertisement
naskedvi

S2 - zad.4

Mar 8th, 2014
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. int f(int a)
  5. {
  6. std:: vector<int> cifre;
  7. int cifra;
  8. while(a!=0)
  9. {
  10. cifra=a%10;
  11. cifre.push_back(cifra);
  12. a=a/10;
  13. }
  14.  
  15. bool isti(false);
  16. for(int i=0; i<cifre.size(); i++)
  17. {
  18. for(int j=i+1; j<cifre.size(); j++)
  19. {
  20. if(cifre[i]==cifre[j])
  21. {
  22. isti=true;
  23. break;
  24. }
  25. }
  26. }
  27. if(isti) return true;
  28. else return false;
  29. }
  30.  
  31. int main()
  32. {
  33. std:: cout<< "Unesite broj: ";
  34. int a;
  35. std:: cin>> a;
  36. if(f(a))
  37. std:: cout<< "Ima istih cifara!";
  38. else
  39. std:: cout<< "Nema istih cifara!";
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement