Guest User

Untitled

a guest
May 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <time.h>
  4. using namespace std;
  5. #include<string>
  6.  
  7. int getdigits(int i, int y)
  8. {
  9. int z=0;
  10. if (i==0)
  11. {
  12. z=y/1000;
  13. }
  14. else if (i==1)
  15. {
  16. z=(y%1000)/100;
  17. }
  18. else if (i==2)
  19. {
  20. z=y%1000;
  21. z=(z%100)/10;
  22. }
  23. else if (i==3)
  24. {
  25. z=y%1000;
  26. z=z%100;
  27. z=z%10;
  28. }
  29. return z;
  30. }
  31.  
  32. int _tmain(int argc, _TCHAR* argv[])
  33. {
  34.  
  35. int x[4];
  36. int z[4];
  37. int y=0;
  38. srand(time(NULL));
  39. for (int i=0; i<4; i++)
  40. {
  41. if (x[i] == z[0] }
  42.  
  43.  
  44. {
  45.  
  46. if x[i]==z[1]
  47. if (x[i] == z[2])
  48. if x[i] == z[3]
  49.  
  50. z = 1;
  51. x = 0;
  52. y = 0;
  53.  
  54. }
  55.  
  56. while (position < z)
  57.  
  58. {
  59.  
  60. if (z == position)
  61. x ++;
  62. y ++;
  63. x++;
  64.  
  65. }
  66. x[i] = rand() % 10;
  67. }
  68. cin>>y;
  69. for (int i=0; i<4; i++)
  70. {
  71. z[i]=getdigits(i, y);
  72. }
  73. cout<<z[0]<<endl;
  74. cout<<z[1]<<endl;
  75. cout<<z[2]<<endl;
  76. cout<<z[3]<<endl;
  77. return 0;
  78. }
Add Comment
Please, Sign In to add comment