fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.  
  10. srand((int) time(0));
  11. int total = 0;
  12. int breakpoint = 0;
  13. int range = 0;
  14. while(breakpoint!=-1){
  15. cout<<"Brakepoint: ";
  16. cin>>breakpoint;
  17. cout<<"Range: ";
  18. cin>>range;
  19.  
  20. int a = 999001;
  21. int b = 999002;
  22. int c = 999003;
  23. int d = 999004;
  24. int e = 999005;
  25. int f = 999006;
  26. int g = 999007;
  27. int h = 999008;
  28. int i = 999009;
  29. int j = 999010;
  30. int k = 999011;
  31. int l = 999012;
  32. int m = 999013;
  33. int n = 999014;
  34. int o = 999015;
  35. int p = 999016;
  36. int q = 999017;
  37. int r = 999018;
  38. int s = 999019;
  39. int t = 999020;
  40. int u = 999021;
  41. int v = 999026;
  42. int w = 999027;
  43. int x = 100028;
  44. int y = 100029;
  45. int z = 100030;
  46.  
  47. while(1){
  48.  
  49. total=-1;
  50. int cnt=0;
  51.  
  52. while(total != 0){
  53. cnt++;
  54. if(cnt>500){
  55. goto esc;
  56. }
  57. z = (rand() % range)-(range/2);
  58. e = (rand() % range)-(range/2);
  59. r = (rand() % range)-(range/2);
  60. o = (rand() % range)-(range/2);
  61. total = z+e+r+o;
  62. }
  63. if(breakpoint==0){
  64. cout<<"Done @ 0: "<<total<<endl;
  65. break;
  66. }
  67. cnt=0;
  68.  
  69. while(total != 1 || n==z || z==o || o==r || r==e){
  70. cnt++;
  71. if(cnt>500){
  72. goto esc;
  73. }
  74. n = (rand() % range)-(range/2);
  75. total = o+n+e;
  76.  
  77. }
  78. if(breakpoint==1){
  79. cout<<"Done @ 1: "<<total<<endl;
  80. break;
  81. }
  82. cnt=0;
  83.  
  84. while(total != 2 || t==w || w==o || o==n || n==e || e==z || z==r){
  85. cnt++;
  86. if(cnt>500){
  87. goto esc;
  88. }
  89. t = (rand() % range)-(range/2);
  90. w = (rand() % range)-(range/2);
  91. total=t+w+o;
  92.  
  93. }
  94.  
  95.  
  96. cnt=0;
  97.  
  98. if(breakpoint==2){
  99. cout<<"Done @ 2: "<<total<<endl;
  100. break;
  101. }
  102.  
  103. while(total !=3 || t==h || h==r || r==e || e==w || w==o || o==n){
  104. cnt++;
  105. if(cnt>500){
  106. goto esc;
  107. }
  108. h = (rand() % range)-(range/2);
  109.  
  110. total=t+h+r+e+e;
  111. }
  112. if(breakpoint==3){
  113. cout<<"Done @ 3: "<<total<<endl;
  114. break;
  115. }
  116. cnt=0;
  117.  
  118. while(total !=4 || f==o || o==u || u==r || r==n || n==e || e==t || t==w || w==h){
  119.  
  120. cnt++;
  121. if(cnt>500){
  122. goto esc;
  123. }
  124.  
  125. f = (rand() % range)-(range/2);
  126. u = (rand() % range)-(range/2);
  127. total=f+o+u+r;
  128.  
  129. }
  130.  
  131. cnt=0;
  132. if(breakpoint==4){
  133. cout<<"Done @ 4: "<<total<<endl;
  134. break;
  135. }
  136.  
  137. while(total !=5 || f==i || i==v || v==e || e==o || o==n || n==t || t==w || w==h || h==r || r==f || f==u){
  138. cnt++;
  139. if(cnt>500){
  140. goto esc;
  141. }
  142.  
  143. i = (rand() % range)-(range/2);
  144. v = (rand() % range)-(range/2);
  145. total=f+i+v+e;
  146.  
  147.  
  148. }
  149. cnt=0;
  150. if(breakpoint==5){
  151. cout<<"Done @ 5: "<<total<<endl;
  152. break;
  153. }
  154. while(total !=6 || s==x || x==f || f==i || i==v || v==e || e==o || o==n || n==t || t==w || w==h || h==r || r==f || f==u){
  155. cnt++;
  156. if(cnt>500){
  157. goto esc;
  158. }
  159. s = (rand() % range)-(range/2);
  160. x = (rand() % range)-(range/2);
  161. total=s+i+x;
  162.  
  163.  
  164. }
  165. cnt=0;
  166. if(breakpoint==6){
  167. cout<<"Done @ 6: "<<total<<endl;
  168. break;
  169. }
  170. total=s+e+v+e+n;
  171. if(total!=7){
  172. goto esc;
  173. }
  174. if(breakpoint==7){
  175. cout<<"Done @ 7: "<<total<<endl;
  176. break;
  177. }
  178. while(total !=8 || v==g || g==s || s==x || x==f || f==i || i==v || v==e || e==o || o==n || n==t || t==w || w==h || h==r || r==f || f==u){
  179. cnt++;
  180. if(cnt>500){
  181. goto esc;
  182. }
  183. g = (rand() % range)-(range/2);
  184. total=e+i+g+h+t;
  185. cnt++;
  186. }
  187. cnt=0;
  188. if(breakpoint==8){
  189. cout<<"Done @ 8 :"<<total<<endl;
  190. break;
  191. }
  192. total=n+i+n+e;
  193. if(total!=9){
  194. goto esc;
  195. }
  196. if(breakpoint==9){
  197. cout<<"Done @ 9: "<<total<<endl;
  198. break;
  199. }
  200. total=t+e+n;
  201. if(total!=10){
  202. goto esc;
  203. }
  204. if(breakpoint==10){
  205. cout<<"Done @ 10: "<<total<<endl;
  206. break;
  207. }
  208.  
  209. esc:
  210. int foo=1;
  211. }
  212. cout<<"ZERO: "<<z<<" "<<e<<" "<<r<<" "<<o<<" "<<z+e+r+o<<endl;
  213. cout<<"ONE: "<<o<<" "<<n<<" "<<e<<" "<<o+n+e<<endl;
  214. cout<<"TWO: "<<t<<" "<<w<<" "<<o<<" "<<t+w+o<<endl;
  215. cout<<"THREE: "<<t<<" "<<h<<" "<<r<<" "<<e<<" "<<e<<" "<<t+h+r+e+e<<endl;
  216. cout<<"FOUR: "<<f<<" "<<o<<" "<<u<<" "<<r<<" "<<f+o+u+r<<endl;
  217. cout<<"FIVE: "<<f<<" "<<i<<" "<<v<<" "<<e<<" "<<f+i+v+e<<endl;
  218. cout<<"SIX: "<<s<<" "<<i<<" "<<x<<" "<<s+i+x<<endl;
  219. cout<<"SEVEN: "<<s<<" "<<e<<" "<<v<<" "<<e<<" "<<n<<" "<<s+e+v+e+n<<endl;
  220. cout<<"EIGHT: "<<e<<" "<<i<<" "<<g<<" "<<h<<" "<<t<<" "<<e+i+g+h+t<<endl;
  221. cout<<"NINE: "<<n<<" "<<i<<" "<<n<<" "<<e<<" "<<n+i+n+e<<endl;
  222. cout<<"TEN: "<<t<<" "<<e<<" "<<n<<" "<<t+e+n<<endl;
  223.  
  224. }
  225. return 0;
  226. }
Runtime error #stdin #stdout 0.01s 3468KB
stdin
Standard input is empty
stdout
Brakepoint: