You will read in two strings from a file cp4in_1. Txt at a time (there will be 2n strings, and you will read them until EOF) and then do the following. You alternately take characters from the two strings and string them together and create a new string which you will store in a new string variable. You may assume that each string is no more than 20 characters long (not including the null terminator), but can be far less. You must use pointers. You may store each string in an array, but are not allowed to treat the string as a character array in the sense that you may not have statements like c[i]

Respuesta :

Use the knowledge in computational language in C++ to write the  a character array .

How to define an array in C++?

An Array is a set of values ​​arranged in lists and accessible through a positive numeric index. So, we have that each position of our Array is a variable of the type of our Array, so we have to have a way to initialize this set of variables.

So in an easier way we have that the code is:

#include <stdio.h>

#include <studlib.h>

int main()

{

File*fp;

fp=fopen("cp4in_1.txt","r");

char ch;

//while(1)

//{

while(!feof(fp))

{

char *s1,*s2,*s3;

s1 = (char*)malloc (20 *sizeof (char));

s2 = (char*)malloc (20 *sizeof (char));

s3 = (char*)malloc (20 *sizeof (char));

int i=0,j=0,x,y;

while(1)

{

ch=getc(fp);

if(ch=='\n')

break;

*(s1+i)=ch;

i++;

}

while(1)

{

ch=getc(fp);

if(ch=='\n')

break;

*(s2+j)=ch;

j++;

}

for(x=0;x<i;x++)

{

*(s3+x)=*(s1+x);

}

for(y=0;y<j;x++,y++)

{

*(s3+x)=*(s2+y);

}

for(x=0;x<i+j;x++)

{

printf("%c",*(s3+x));

}

printf("\n");

getc(fp);

}

}

See more about C++ code at brainly.com/question/19705654

Ver imagen lhmarianateixeira