如何在C ++中的main函数中输出两个新字符串?

我需要编写一个程序,其中将char数组初始化并拆分为2个没有连接字符的新c样式字符串。当我将void函数用作单独的程序时,它可以工作,但是当我在main函数中调用它时,它就没有作用。我的函数调用方式是否错误或代码编写方式是否有误?该程序的工作方式如下:chara数组被初始化为Frenk + Harizaj,并且void函数检查每个字符,直到到达+,将其分配给sName,然后在+之后继续检查,将其分配给sSurname并输出两个字符串


       #include <iostream>
       using namespace std;

       void splitter(char s[])
       {

           int i, x, counter;
           char sName[20]="";
           char sSurname[20]="";

           for(i=0; s[i]!='\0'; i++)
           {
               counter++;
           }

           for (i=0; i!='+'; i++)
           {
               sName[i]=s[i];

               if(s[i+1]=='+')
               {
                   for(x=i+2; x<counter; x++)
                   {
                       sSurname[x-(i+2)]=s[x];
                   }
                   i=counter;
               }
           }

           cout<<"Name: "<<sName<<endl;
           cout<<"Surname: "<<sSurname<<endl;
       }



       int main()
       {
           int a, b;
           int i=0, j=0, k=0; 

           char s[]="Frenk+Harizaj";

           char firstName[10], lastName[10], fullName[20], character[2];

           cout<<"Press 1 to merge two strings: "<<endl;
           cout<<"Press 2 to split two strings: "<<endl;
           cin>>a;

           if(a==1)
           {
               cout<<"Enter your first name: ";
               cin.ignore();
               cin.getline(firstName, 15);

               cout<<"Enter your last name: ";
               cin.getline(lastName, 15);
               cout<<endl;

               cout<<"Connecting character: "<<endl;
               cout<<"Press 1 for no connecting character "<<endl;
               cout<<"Press 2 to enter connecting character "<<endl;

               cin>>b;

               if(b==1)
               {
                   for(i; firstName[i]!='\0'; i++)
                   {
                       fullName[i]=firstName[i];
                   }


                   for(i, j; lastName[j]!='\0'; i++, j++)
                   {
                       fullName[i]=lastName[j];
                   }

                   cout<<fullName;
               }

               else if(b==2)
               {
                   cout<<"Enter the connecting character: ";
                   cin.ignore();
                   cin.getline(character, 2);

                   for(i; firstName[i]!='\0'; i++)
                   {
                       fullName[i]=firstName[i];
                   }

                   for(i, k; character[k]!='\0'; i++, k++)
                   {
                       fullName[i]=character[k];
                   }

                   for(i, j; lastName[j]!='\0'; i++, j++)
                   {
                       fullName[i]=lastName[j];
                   }

                   cout<<fullName;
               }
           }

           if(a==2)
           {   
               splitter(s);
           }


       }
   ```