fork download
  1.  
  2.  
  3. #include<iostream>
  4. #include<string>
  5. using namespace std;
  6.  
  7. void setupStrings(string[], int);
  8. void bubbleSort(string[], int);
  9.  
  10. int main()
  11. {
  12. string str1000[1000], str2000[2000], str3000[3000];
  13. string str4000[4000], str5000[5000], str6000[6000];
  14.  
  15. setupStrings(str1000, 1000);
  16. setupStrings(str2000, 2000);
  17. setupStrings(str3000, 3000);
  18. setupStrings(str4000, 4000);
  19. setupStrings(str5000, 5000);
  20. setupStrings(str6000, 6000);
  21.  
  22. for (int i = 0; i < 100; i++)
  23. {
  24. cout << i << " " << str1000[i] << endl;
  25. }
  26.  
  27. cout << endl;
  28. bubbleSort(str1000, 1000);//does not sort
  29.  
  30. for (int i = 0; i < 100; i++)
  31. {
  32. cout <<i<<" "<< str1000[i] << endl;
  33. }
  34.  
  35.  
  36. return 0;
  37. }
  38.  
  39. void setupStrings(string array[], int size)
  40. {
  41.  
  42. char charset[52] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
  43. 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
  44. 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
  45. string randomstr;
  46. int randomdx;
  47. for (int x = 0; x < size; x++)
  48. {
  49. for (int i = 1; i <= 25; i++)
  50. {
  51. randomdx = rand() % 52;
  52. randomstr = randomstr + charset[randomdx];
  53. }
  54. array[x] = randomstr;
  55. randomstr.erase(0, 25);
  56. }
  57.  
  58.  
  59. }
  60.  
  61. void bubbleSort(string array[], int size)
  62. {
  63. string temp;
  64. int swap=0;
  65. int i = 0;
  66. for (i = 0; i < size;)
  67. {
  68.  
  69. if (array[i] > array[i + 1])
  70. {
  71. temp = array[i];
  72. array[i] = array[i + 1];
  73. array[i + 1] = temp;
  74.  
  75. }
  76. // temp.erase(0, 25);
  77. i++;
  78. }
  79.  
  80. return;
  81.  
  82. }
  83.  
Success #stdin #stdout 0.1s 3476KB
stdin
Standard input is empty
stdout
0 NwLRbBMqbHcdARZoWkKyhidDQ
1 scdxRjMowfRXSJYbLDBefsaRc
2 bYNeCDYgGXXPKlOrELLnmpAPQ
3 FwKhopKmcOqhNwNKueWhSQMgB
4 BUQcljjIvSWmDKQTbXixmvtrr
5 BLJPtNSnfwzQFJmaFaDRRwSOF
6 SbCNUvQhfFBSaqXwPqcaCEhCh
7 ZVfRKmlnOZJkPQpXrJXkitZyX
8 aCBhHkICqcOenDTOmFgdwdWfC
9 gPxIQvkUyTdlCGdEWhtACioho
10 rDTQkvWCSgsPqOQMSboaGuWNN
11 YqxnZLgDgWpBTRWBLnSAdEUGu
12 UmOQCdruBEtOKyxHOAchwDvmX
13 xRdryxlmNDqtUKwaGMLejUuKW
14 CIbXUBuMEnMEyATDRmydIaJXL
15 OghiQFmzHLViHjoUVSUYoyPAy
16 uLyeIMuOTehzriIcFsKPGgKbb
17 IpzZrzucXamluDfyKgruOWZgi
18 OoobpplEqlWPhApJNAdqhdCnv
19 WDTxJbmYpPPhauxNSPUsGDHIi
20 XQmbFjXjcvudjsUYibYebMWsi
21 QYoyGYXYMZEVypzvJegEBeoCF
22 UfTsxDiXtigsIeeHkCHzDFLIL
23 RjQfnXZtQrsVbSpkYHSEnbPPk
24 QtPdDBUoTBBQcwiVrFXjUJJdd
25 nTGEIQvDGaIJVWCYaUbwEWpjv
26 yGehlJXepBpIWuQzdzuBDUBZV
27 AfSPQPQwUzIfwovYDdwYvVbUR
28 CZMGYjgFDxvtnunNEsLSplwUI
29 upfXLzbKNHkWpPANlTCFIRjCD
30 DSOZoYVEGuRfwCSFMOxeQMRJo
31 wrghwlKoBmeAhkgCcNAEhHSVe
32 yMQpXHLRNunYfdzrhBasjeuyg
33 AFOUButPNIMuWfJqsjXvkQDoR
34 xxVRWcTdsNEogVbPkXLpGDIrB
35 FCriQiFPGYnkRreFxsnVucfTp
36 WcTgtWMxnUPYcFgCuqunuBLMO
37 iItnCkLEFSzBEXraMpETvhQnd
38 djEqVUygPnkaZqFRPJvoaXDpC
39 wmJObMSkSKfojNewXGXnNOFwL
40 TwJwnNvbwjcKDmeoUUZHYvhgV
41 WUJBqXXpitCVOgrAiDdvHrRdS
42 ycQhKLeEWhxTeMbaQWqWPQHsU
43 EBNvFGvjwDvJjaFqZzXLcXdZn
44 CqGjlApoPKvXfgVICEtCMKBlj
45 OPgtqVVHBGSDVIVheSnkqxMwR
46 QidrVmHLUbbrykTHEYenTmrob
47 dEyQCRGLUAiIhveixwjjRQOPU
48 bJgUXhXdipFZWSwYbGfYLQvJZ
49 hArVRlyAUUZDRcnJkPhclfFRk
50 EeCBpdIPufHiDJcxJhRnXcxMj
51 cXoHqaNXDRmGzEbhNLmwpmHwd
52 VtHsfQuEeExGrujiGskMVrzGf
53 WVrfTWaPDtUtpbZTyGNSrxaJj
54 NgcOMiKjzsdwsSZnoVDRUYpcn
55 JuLKFUZMXNafaMEsPCKjCAZxd
56 RTDgyRQSCcZYbnVqQCqCJITlV
57 cNvbMaSiDZGWraatZZWPwmFBf
58 JkNCvkELhhZJChPdNLuNMppnl
59 GJZNkewWuYsgeFoNEXpMMsbao
60 PMDGZqmkqZXuvTqVNxBsLQzkg
61 lzamzpDNSjoLvybWXXTtQOgnR
62 bAIAKqLLSzkhFzCONnMOQkLpe
63 efSNsmOuwQHodsgCfohEsyshM
64 gXWtOayUvNOjdjFTQTWKBaPri
65 uJiMQwSpslGVlcSAQbDBGwTbs
66 EettwdNfNbyjvpdjxYuzQxSta
67 tBZPCTtHOoFREmgFKRbCVkZvg
68 bOfThgOJHDNAyWpNBITOraaib
69 edNezwfPdAWLohsSVTqtKFVsy
70 lJzlucqxsWyqDntdMfrTZLqSE
71 KejhZksklfEPXchvcZYSVDgCx
72 BBiSWMeaylZIfkTMOIKssfXTG
73 POjxqiYSrsqFwqdjqnQcgDQrn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EeExGrujiGskMVrzGf
52 WVrfTWaPDtUtpbZTyGNSrxaJj
53 NgcOMiKjzsdwsSZnoVDRUYpcn
54 JuLKFUZMXNafaMEsPCKjCAZxd
55 RTDgyRQSCcZYbnVqQCqCJITlV
56 cNvbMaSiDZGWraatZZWPwmFBf
57 JkNCvkELhhZJChPdNLuNMppnl
58 GJZNkewWuYsgeFoNEXpMMsbao
59 PMDGZqmkqZXuvTqVNxBsLQzkg
60 lzamzpDNSjoLvybWXXTtQOgnR
61 bAIAKqLLSzkhFzCONnMOQkLpe
62 efSNsmOuwQHodsgCfohEsyshM
63 gXWtOayUvNOjdjFTQTWKBaPri
64 uJiMQwSpslGVlcSAQbDBGwTbs
65 EettwdNfNbyjvpdjxYuzQxSta
66 tBZPCTtHOoFREmgFKRbCVkZvg
67 bOfThgOJHDNAyWpNBITOraaib
68 edNezwfPdAWLohsSVTqtKFVsy
69 lJzlucqxsWyqDntdMfrTZLqSE
70 KejhZksklfEPXchvcZYSVDgCx
71 BBiSWMeaylZIfkTMOIKssfXTG
72 POjxqiYSrsqFwqdjqnQcgDQrn
73 LlUIeAZvmwnuufnNXvLoyVgML
74 iuQAndlyAvfauAOsNLNvAcsVp
75 iuMoIawcQXSwKqWgXyAZnTNAi
76 KaMEybNuqbcqaGgXaCHryNQXQ
77 QMlfOtPqHVOkIiAmMQmVXjVbs
78 OAIFZyXnJcbERrNMIXXsyjHov
79 eNgBPyqRIxQgWdrYGxrXkFhiC
80 AinhwIlkqMBPEsZDigzNZxtZq
81 SjWaTycbMjaWWMnInEPFDUplu
82 cltXMKPVGrrGtUseURaGelTkC
83 apwpBQroMQawixEzqkvlfbHWc
84 oCPJMrmbpBegvsulUQtUuvkEs
85 vJtdhvTJMeXFqBVuFDPAXCWNW
86 QJTbPlYzEDiCwSodPwtqrpyUe
87 ARHwgfnPAQELOFRsOtqiktXip
88 QzEQVlqMuoubBjBrpmIxFClBS
89 tnOSvdkUjCPWSdqhxrkiueZio
90 wOQjpIeCwXXbJtNmKJGNCpMvA
91 UQgTAuSokbfugjtFIuQbJcLVl
92 aZAMuCiMIcnEwdOxjLfUemDad
93 gKHuFSuEVJAxRnIvcORHfRQQW
94 nUjQUOyEvSLQPRLysKRhUnLJG
95 sOxLEuYyfqUTOzQHMGYETYyEP
96 FaESJlkZIVDEvDlLyGAzxJNdj
97 rXhrdyyddqNQdoaYShWXsHXZJ
98 YwUMbFFAMXDNXjQoyirMiRERN
99 ekXDLiCJFQKkvNXUqmSzcIXMZ