Advertisement
obstinado-yamada

exercice 2

Jan 16th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <ctime>
  4. #include <cstdlib>
  5. using namespace std;
  6. string melangerLettres(string mot)
  7. {
  8. string khalit;
  9. int makane(0);
  10. int b;
  11. b=0;
  12. while (mot.size() != 0)
  13. {
  14.  
  15. makane = rand() % mot.size();
  16.  
  17. khalit += mot[makane];
  18.  
  19. mot.erase(makane, 1);
  20. b++;
  21. if(b==11)goto a;
  22. }
  23. a:
  24. return khalit;
  25. }
  26. int main()
  27. {
  28. string nomeKey, motkey;
  29.  
  30. srand(time(0));
  31.  
  32. nomeKey="abcdefghijklmnopqrstvwxyzABCDEFGHIJKLMNOPQRSTVWXYZ12345789";
  33. motkey = melangerLettres(nomeKey);
  34. cout << endl << "hada hwa ramzok seri:          " << motkey << endl;
  35.  
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement