Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. cout << "Zadajte pocet prvkov pola, najviac 20" << endl;
  8. int A[20],B[20],n,i,m,j,k,pom,pocet=0,je=0;
  9. cin>>n;
  10. cout<<"Zadajte lubovolne cisla do pola, ja napisem ktore cisla sa opakuju"<<endl;
  11. for (i=0;i<n;i++)
  12. {
  13. cin>>m;
  14. A[i]=m;
  15. }
  16.  
  17. for (i=0;i<n;i++)
  18. {
  19. pom=0;
  20. je=0;
  21. for (k=0;k<pocet;k++)
  22. {
  23. if(A[i]==B[k])
  24. je=1;
  25. }
  26. if(je==0){
  27. for (j=0;j<n;j++)
  28. {
  29. if (A[i]==A[j])
  30. {
  31. pom++;
  32. }
  33. }
  34. }
  35. if (pom>1){
  36. B[pocet++]=A[i];
  37. cout<<"Cislo "<<A[i]<<" sa opakuje "<<pom<<" krat"<<endl;
  38. }
  39. }
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement