Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- void StringMix(int count, const char *str, ...);
- int main()
- {
- const char *str1 = "1234567890";
- const char *str2 = "qwert";
- const char *str3 = "Hello World!!!!";
- const char *str4 = "zxcvbnmasdfghjkl";
- StringMix(2,str1,str2);
- //StringMix(3,str1,str2,str3);
- char a;
- std::cin >> a;
- return 0;
- }
- void StringMix(int count, const char* str, ...)
- {
- const char **TempStr;
- char *ResultString="\0";
- TempStr=&str;
- // if (count==1)
- // return *TempStr;
- bool AllStringsDone=false; //признак обработки всех строк
- while(!AllStringsDone)
- {
- AllStringsDone=true;
- for(int i=0; i<count; i++)
- {
- if((*(TempStr[i]))!='\0')
- {
- strncat(ResultString,TempStr[i],1); //добавление одного символа
- TempStr[i]++; //переход к следующему символу
- AllStringsDone=false; //было хотя бы одно добавление в результирующую строку
- }
- }
- }
- std::cout << ResultString;
- // return ResultString;
- }
Add Comment
Please, Sign In to add comment