Guest User

Untitled

a guest
May 4th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3.  
  4. void StringMix(int count, const char *str, ...);
  5.  
  6.  
  7. int main()
  8. {
  9. const char *str1 = "1234567890";
  10. const char *str2 = "qwert";
  11. const char *str3 = "Hello World!!!!";
  12. const char *str4 = "zxcvbnmasdfghjkl";
  13. StringMix(2,str1,str2);
  14. //StringMix(3,str1,str2,str3);
  15. char a;
  16. std::cin >> a;
  17.  
  18. return 0;
  19. }
  20. void StringMix(int count, const char* str, ...)
  21. {
  22. const char **TempStr;
  23. char *ResultString="\0";
  24. TempStr=&str;
  25. // if (count==1)
  26. // return *TempStr;
  27. bool AllStringsDone=false; //признак обработки всех строк
  28. while(!AllStringsDone)
  29. {
  30. AllStringsDone=true;
  31. for(int i=0; i<count; i++)
  32. {
  33. if((*(TempStr[i]))!='\0')
  34. {
  35. strncat(ResultString,TempStr[i],1); //добавление одного символа
  36. TempStr[i]++; //переход к следующему символу
  37. AllStringsDone=false; //было хотя бы одно добавление в результирующую строку
  38. }
  39. }
  40. }
  41. std::cout << ResultString;
  42. // return ResultString;
  43. }
Add Comment
Please, Sign In to add comment