#include<iostream> #include<string> using namespace std; void setupStrings(string[], int); void bubbleSort(string[], int); int main() { string str1000[1000], str2000[2000], str3000[3000]; string str4000[4000], str5000[5000], str6000[6000]; setupStrings(str1000, 1000); setupStrings(str2000, 2000); setupStrings(str3000, 3000); setupStrings(str4000, 4000); setupStrings(str5000, 5000); setupStrings(str6000, 6000); for (int i = 0; i < 100; i++) { cout << i << " " << str1000[i] << endl; } cout << endl; bubbleSort(str1000, 1000);//does not sort for (int i = 0; i < 100; i++) { cout <<i<<" "<< str1000[i] << endl; } return 0; } void setupStrings(string array[], int size) { char charset[52] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }; string randomstr; int randomdx; for (int x = 0; x < size; x++) { for (int i = 1; i <= 25; i++) { randomdx = rand() % 52; randomstr = randomstr + charset[randomdx]; } array[x] = randomstr; randomstr.erase(0, 25); } } void bubbleSort(string array[], int size) { string temp; int swap=0; int i = 0; for (i = 0; i < size;) { if (array[i] > array[i + 1]) { temp = array[i]; array[i] = array[i + 1]; array[i + 1] = temp; } // temp.erase(0, 25); i++; } return; }
Standard input is empty
0 NwLRbBMqbHcdARZoWkKyhidDQ 1 scdxRjMowfRXSJYbLDBefsaRc 2 bYNeCDYgGXXPKlOrELLnmpAPQ 3 FwKhopKmcOqhNwNKueWhSQMgB 4 BUQcljjIvSWmDKQTbXixmvtrr 5 BLJPtNSnfwzQFJmaFaDRRwSOF 6 SbCNUvQhfFBSaqXwPqcaCEhCh 7 ZVfRKmlnOZJkPQpXrJXkitZyX 8 aCBhHkICqcOenDTOmFgdwdWfC 9 gPxIQvkUyTdlCGdEWhtACioho 10 rDTQkvWCSgsPq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yAUUZDRcnJkPhclfFRk 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 74 LlUIeAZvmwnuufnNXvLoyVgML 75 iuQAndlyAvfauAOsNLNvAcsVp 76 iuMoIawcQXSwKqWgXyAZnTNAi 77 KaMEybNuqbcqaGgXaCHryNQXQ 78 QMlfOtPqHVOkIiAmMQmVXjVbs 79 OAIFZyXnJcbERrNMIXXsyjHov 80 eNgBPyqRIxQgWdrYGxrXkFhiC 81 AinhwIlkqMBPEsZDigzNZxtZq 82 SjWaTycbMjaWWMnInEPFDUplu 83 cltXMKPVGrrGtUseURaGelTkC 84 apwpBQroMQawixEzqkvlfbHWc 85 oCPJMrmbpBegvsulUQtUuvkEs 86 vJtdhvTJMeXFqBVuFDPAXCWNW 87 QJTbPlYzEDiCwSodPwtqrpyUe 88 ARHwgf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xYuzQxSta 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