Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. const int MAX_PASSWORD = 6;
  5.  
  6. bool no_esta_repetido(int valores[], int siguiente, int limite);
  7. int main(int argc, char * argv[]){
  8.  
  9. int arr[] = { 1, 4, 5, 7, 5, 7, 8, 2 };
  10.  
  11. for (int valor = 0; valor < 8; ++valor){
  12. if (valor == 0)
  13. cout << arr[valor] << " ";
  14. else{
  15. if (!no_esta_repetido(arr, arr[valor], valor)){
  16. cout << arr[valor] << " ";
  17. }
  18. }
  19. }
  20. std::cin.get();
  21. }
  22.  
  23. bool no_esta_repetido(int valores[], int siguiente, int limite){
  24. for (int valor = 0; valor < limite; ++valor)
  25. if (valores[valor] == siguiente)
  26. return true;
  27. return false;
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement