fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int ar[5];
  6. int j = 0, num = 0;
  7. while(j != 5)
  8. {
  9. cout<< "Please, enter a number: ";
  10. cin >> num;
  11. if(j == 0)
  12. {
  13. ar[j] = num;
  14. cout << ar[j];
  15. }else{
  16. for(int i = 0; i < j; i++)
  17. {
  18. if(ar[i] != num)
  19. {
  20. ar[j] = num;
  21. }
  22. cout << ar[i];
  23. }
  24. j++;
  25. }
  26.  
  27. j++;
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 15224KB
stdin
1
stdout
Please, enter a number: 1Please, enter a number: 1Please, enter a number: 102