#include <string.h>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
string add_Tab(int *t1, int *t2, int s)
{
#define buf_s 20
int i,j,k;
int *temp=new int[s*2];
char **tab_Buff;
for(i=0,j=0,k=1;i<s;i++,j+=2,k+=2)
{
temp[j]=t1[i];
temp[k]=t2[i];
}
tab_Buff=new char *[s*2];
for(i=0;i<s*2;i++)
{
tab_Buff[i]=new char[buf_s];
}
string string_Tab;
for(i=0;i<s*2;i++)
{
snprintf(tab_Buff[i],sizeof(tab_Buff[i]),"%d",temp[i]);
}
for(i=0;i<s*2;i++)
string_Tab+=tab_Buff[i];
delete temp;
for(i=0;i<s*2;i++)
delete [] tab_Buff[i];
delete tab_Buff;
return string_Tab;
}
int main(int argc, char **argv)
{
int tab1[5]={0,2,4,6,8};
int tab2[5]={-1,-3,-5,-7,-9};
string connect_T=add_Tab(tab1,tab2,5);
cout<<connect_T<<endl;
return 0;
}
YOU CAN PAY ME - https://paypal.me/LukaszW77?locale.x=pl_PL
Brak komentarzy:
Prześlij komentarz