1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Rina8888 [55]
3 years ago
15

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]
Computers and Technology
1 answer:
Novosadov [1.4K]3 years ago
5 0

In this exercise we have to use the knowledge in computational language in C++ to write the following code:

We have the code can be found in the attached image.

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

<em>#include <stdio.h></em>

<em>#include <studlib.h></em>

<em>int main() </em>

<em>{</em>

<em> File*fp;</em>

<em>fp=fopen("cp4in_1.txt","r");</em>

<em>char ch;</em>

<em>//while(1)</em>

<em>//{</em>

<em>while(!feof(fp))</em>

<em>{</em>

<em>char *s1,*s2,*s3;</em>

<em>s1 = (char*)malloc (20 *sizeof (char));</em>

<em>s2 = (char*)malloc (20 *sizeof (char));</em>

<em>s3 = (char*)malloc (20 *sizeof (char));</em>

<em>int i=0,j=0,x,y;</em>

<em>while(1)</em>

<em>{</em>

<em>ch=getc(fp);</em>

<em>if(ch=='\n')</em>

<em>break;</em>

<em>*(s1+i)=ch;</em>

<em>i++;</em>

<em>}</em>

<em>while(1)</em>

<em>{</em>

<em>ch=getc(fp);</em>

<em>if(ch=='\n')</em>

<em>break;</em>

<em>*(s2+j)=ch;</em>

<em>j++;</em>

<em>}</em>

<em>for(x=0;x<i;x++)</em>

<em>{</em>

<em>*(s3+x)=*(s1+x);</em>

<em>}</em>

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

<em>{</em>

<em>*(s3+x)=*(s2+y);</em>

<em>}</em>

<em>for(x=0;x<i+j;x++)</em>

<em>{</em>

<em>printf("%c",*(s3+x));</em>

<em>}</em>

<em>printf("\n");</em>

<em>getc(fp);</em>

<em>}</em>

<em>}</em>

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

You might be interested in
Match the column.<br> Description Shortcut key<br> Move to next cell in row page up
Musya8 [376]

The matchup are:

1) move to next cell in row - tab

2) move to previous cell in row - shift+tab

3) up one screen - page up

4) down one screen - page down

5) move to next worksheet - ctrl + page down

6) move to previous worksheet - ctrl + page up

7) go to first cell in data region - ctrl+ home

8) go to last cell in data region - ctrl + end

<h3>What are computer shortcut keys?</h3>

A computer shortcut is known to be some group of one or a lot of keys that brings about a command in software or in any kind of operating system.

Hence, The matchup are:

1) move to next cell in row - tab

2) move to previous cell in row - shift+tab

3) up one screen - page up

4) down one screen - page down

5) move to next worksheet - ctrl + page down

6) move to previous worksheet - ctrl + page up

7) go to first cell in data region - ctrl+ home

8) go to last cell in data region - ctrl + end

Learn more about computer shortcut from

brainly.com/question/12531147

#SPJ1

4 0
2 years ago
An app builder has created a report for sales people to view records from the custom object, some users have complained that the
Mila [183]

Answer:

There is a need for some people to see the total transparency of the records that are meant to be shared with a select group of people. There are certain things that can be done for this. The first one is that the sharing rules should be checked. To whom are the details shared with. The next one is the filters that are used.

These can be reported and changed accordingly. Lastly, the whole organization’s defaults can be checked. This is something that can be done when the previous methods that were done did not work that well. Once some changes are done, the people can check if they already work and if the records can be viewed.

Explanation:

8 0
3 years ago
Which of the following are the differences between DDR3 SDRAM and DDR2 SDRAM? DDR3 transfers data at twice the rate of DDR2. DDR
Free_Kalibri [48]

Answer:

DDR3 SDRAM having twice rate of data transferring as compared to DDR2 SDRAM both have 240 pin connection. DDR3 memory power consumption is 40 % less as compared to DDR2. both are transfers data on a 64 data bits wide bus. The physical difference occur in both type a cut is present at bottom along pin in DDR2 it is occur probably in center and In DDR3 it is occur at left  through center.

7 0
3 years ago
Which of the following statements is true?
Alex787 [66]
Seasons are caused by the earths changing distance from the sun
6 0
3 years ago
using a for loop, write a program that prints out the decimal equivalents of 1/2, 1/3, 1/4,..., 1/10.
ValentinkaMS [17]
In python:

##Specifies the range that the variable 'number' should change within
for number in range(2,10):
##Prints the decimal equivalent of each fraction
    print(1 / number)
5 0
4 years ago
Other questions:
  • A form that dedicates a page for each item retrieved for a case; it allows investigators to add more detail about exactly what w
    10·1 answer
  • How to save customised keyboard shortcuts on word
    11·1 answer
  • An employee at your graphic design firm needs a solid computer that can handle the variety of graphics and animations he works w
    7·2 answers
  • Being technologically literate requires being able to ______.
    11·2 answers
  • One of the main purposes of special effects is to accomplish shots that would be too expensive, too dangerous or just plain impo
    9·2 answers
  • A common type of non-volatile memory is _____.
    12·1 answer
  • The Classic Triangle Testing Problem, (Myer's Triangle): A program reads three integer values. The three values are interpreted
    10·1 answer
  • Jennifer has her own business. Recently, she has ventured into creation of a new line of apparel. She has created a new symbol t
    14·2 answers
  • In the library 6 students are working on math. of those 6 students 2/3 of them are working on fractions. how many students are w
    13·1 answer
  • when you sent email your email can be set to automatically keep a copy where do you find these copies​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!