fork download
  1. #include <iostream>
  2. #include <random>
  3. #include <algorithm>
  4. #include <vector>
  5.  
  6. template<class T1,class T2,std::size_t N>
  7. bool Copy(T1(&Dest)[N], T2(&Src)[N]){
  8. for (size_t i = 0; i < N; i++)
  9. {
  10. Dest[i] = Src[i];
  11. }
  12.  
  13. return true;
  14. }
  15.  
  16. int main(){
  17. static const int N = 16;
  18. char ArrayA[N] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
  19. int ArrayB[N];
  20.  
  21. std::random_device RD;
  22. std::mt19937 mt(RD());
  23.  
  24. std::cout << "Start The Program"<< std::endl;
  25.  
  26. std::shuffle(ArrayA, ArrayA + N, mt);
  27. Copy(ArrayB, ArrayA);
  28.  
  29. std::vector<int> ArrayC{ArrayB,ArrayB+N};
  30. std::vector<int> ArrayD;
  31. ArrayD = ArrayC;
  32.  
  33. for (size_t i = 0; i < N; i++)
  34. {
  35. if (ArrayA[i] != ArrayB[i]) std::cout << "Array Is MissMatch!!:" << i << std::endl;
  36. if (ArrayB[i] != ArrayC[i]) std::cout << "Array Is MissMatch!!:" << i << std::endl;
  37. if (ArrayC[i] != ArrayD[i]) std::cout << "Array Is MissMatch!!:" << i << std::endl;
  38. }
  39.  
  40. std::cout << "End of Program"<< std::endl;
  41.  
  42. return 0;
  43.  
  44.  
  45. }
Success #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
Start The Program
End of Program