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
erik [133]
3 years ago
11

Write the definition of a function named fscopy. This function can be safely passed two fstream objects, one opened for reading,

the other for writing. Assume that the input source is a text file consisting of a sequence of newline character-terminated lines. The function simply copies, line by line, the entire content of the data source associated with the first argument to the data target associated with the second argument. No value is returned.
Computers and Technology
1 answer:
diamong [38]3 years ago
6 0

Question:

Write the definition of a function named fscopy that does a line-by-line copy from one stream to another. This function can be safely passed two fstream objects, one opened for reading, the other for writing. In addition, it gets a bool argument that is true if the output lines are to be numbered, and another argument, an int that specifies line-spacing in the output.

Assume that the input source is a text file consisting of a sequence of newline character-terminated lines. The function copies, line by line, the entire content of the data source associated with the first argument to the data target associated with the second argument. It returns the number of lines read in. If it the third parameter, the bool is true, every line that is output is preceded by a 6-position field holding the line number (an integer) followed by a space and then the actual line. If the last argument, the int is 2 or more, it specifies the line spacing: for example, it is 3, there are two blank lines output after each line printed. These blank lines are NOT numbered.

Answer:

void fscopy(fstream &fsin, fstream &fsout)

{

string s;

getline(fsin, s, '\n');

while (!fsin.fail( ) )

{

fsout << s << endl;

getline(fsin, s, '\n');

}

}

You might be interested in
What tool can help discover and report computer errors and conflicts that occur when you first turn on a computer and before the
Morgarella [4.7K]

The answer is a POST Diagnostic Card.

Although not a necessity, a POST card can help discover and report computer errors and conflicts that occur when you first turn on a computer and before the operating system. To be able to understand how a POST card works, one needs to be very familiar with the BIOS. The power-on self test (POST) is a series of various tests performed by a computer when you turn it on. If you have any issues that conflicts with the operating system and prevents the computer from booting, you can install a POST card in the available expansion slots. This card will monitor the entire boot process and report errors in coded numbers on a small LED panel on the card.  

6 0
2 years ago
What is output?
Alex777 [14]

Answer:

The output of this question is 21. As show in the image

The explanation is given in below

Explanation:

Let first write the question

C=1

sum = 0

while(C<10):

C=C+3

sum=sum + C

print(sum)

Now Focus on

while(C<10):

C=C+3

sum=sum + C

The value of C is initially 1

C=1+3

Sum= 0+4

In second loop the value of C will become 4

c=4+3

sum=4+7

In third loop the value of C will be 7

c=7+3

sum=11+10

so the answer is 11+10=21

7 0
2 years ago
A Uniform Resource Locator (URL) consists of three separate parts: network protocol, host, and web browser.
FrozenT [24]
That is false. are you doing it on a computer course.                                             <span />
3 0
3 years ago
Read 2 more answers
Write a program that (a) generates a vector with 20 random integer elements with integers between -29 and 30, (b) replaces all t
Ghella [55]

Answer:

import random

randomlist = []

for i in range(0,20):

n = random.randint(-29,30)

if n < 0 :

n = 100

randomlist.append(n)

print(randomlist)

Explanation:

The random module is first imported as it takes care of random. Number generation.

An empty list called randomliay is created to hold the generated random integers.

Using a for loop, we specify the range of random numbers we want.

Inside the for loop ; we attach our generated random integer which will be in the range (-29 to 30) in a variable n

For each n value generated, if the value is less than 0( it is negative, since all the values are integers), replace the value with 100.

5 0
2 years ago
What is the body of scientific knowledge based on?
ANTONII [103]
It depend on all such as guess ,observation ,hypothesis and etc
3 0
2 years ago
Read 2 more answers
Other questions:
  • All of the nested folders you created will carry the same permissions as the __________ until you make changes.
    10·1 answer
  • #Write a function called "replace_all" that accepts three #arguments: # # - target_string, a string in which to search. # - find
    11·1 answer
  • Recursion is a natural use for a _____ (stack or queue)
    13·1 answer
  • In the history of Social Media what are two points that stood out?
    12·1 answer
  • If a user inserts a piece of clip art over some text but does not want the art to block the text, the user should select
    14·2 answers
  • CLS <br> N = 1<br> FOR J = 1 TO 5 <br> PRINT N<br> N = 10*N+1 <br> NEXT J<br> END
    14·1 answer
  • How many questions have you seen so far other than this one?
    10·2 answers
  • In python, Create a conditional expression that evaluates to string "negative" if user_val is less than 0, and "non-negative" ot
    12·1 answer
  • I need help so bad it’s the entire test for EdHesive python coding Test 2
    5·1 answer
  • Which of these is a possible disadvantage of working with a team?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!