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
Your worksheet has the value 27 in cell B3. What value is<br>returned by the function =MOD(B3,6)?​
Digiron [165]

Answer:

3

Explanation:

MOD means the remainder after a division calculation.

\frac{27}{6}= 4r3

The remainder is 3

5 0
3 years ago
Which sequence represents the hierarchy of terms, from smallest to greatest?
Anni [7]

Answer:

b

Explanation:

7 0
2 years ago
List 5 ways by which Artificial intelligence (AI) can be used to drive our business.​
andreyandreev [35.5K]

Answer:

start a website

Explanation:

true

5 0
2 years ago
class secretType { public: static int count; static int z; secretType(); secretType(int a); void print(); static void incrementY
DanielleElmas [232]

Answer:

The answer to this question can be given as:

In this class definition, there are two constructors.  

Explanation:

In the class definition two constructors are different in type but first we explain constructor that can be as:

Constructor: constructor are special member functions whose task is to initialized as an object of its class.

Rule for defining constructor:

A constructor doesn’t have a return type not even void.

The name of the constructor must be the same as the class name.

A constructor is called automatically when a new instance of an object is created.

Type of constructor:

  1. default constructor.
  2. parameterized constructor.
  3. copy constructor.

In the question there are two type of constructor is used that can be given as:

default constructor:  

The constructor without any parameters is called a default constructor. This type of constructor is called automatically when a new instance of an object is created.

parametrized constructor:

In the parameterized constructor we use at least one parameter in the constructor that is called the parameterized constructor. In the parameterized constructor we can initialize each instance of the class with several values.

Example :

class AB   //define class  

{  

   String name; //define variable

   AB()   //default constructor

   {

   System.out.print("hello...");  //message.

   }

   AB(String name)  //parametrized constructor.

   {  

       this.name = name;  //holding value in name variable.

   }  

}  

class Main  //define class

{  

   public static void main (String[] args)  //main method  

   {  

   AB OB1 =new AB();   //creating class object.

   AB ob2=new AB("XYZ");

   System.out.print(ob2.name);  //print value

   }  

}

Output:

hello... XYZ

5 0
3 years ago
Question is attached as image, please help :&gt;
harkovskaia [24]

Answer:

Proved

Explanation:

Given

X = (a.\bar b)+(\bar a.b)

(a + b)\ .  \frac{}{a.b}

Required

Find out why they represent the same

To do this, we simplify either (a + b)\ .  \frac{}{a.b} or X = (a.\bar b)+(\bar a.b)

In this question, I will simplify (a + b)\ .  \frac{}{a.b}

Apply de morgan's law

(a + b)\ .  \frac{}{a.b} = (a + b) . (\bar a + \bar b)

Apply distribution property

(a + b)\ .  \frac{}{a.b} = a.\bar a + a.\bar b + \bar a . b + b . \bar b

To simplify, we apply the following rules:

a.\bar a = 0 --- Inverse law

b.\bar b = 0 --- Inverse law

So, the expression becomes

(a + b)\ .  \frac{}{a.b} = 0 + a.\bar b + \bar a.b + 0

(a + b)\ .  \frac{}{a.b}  = a.\bar b + \bar a.b

Rewrite as:

(a + b)\ .  \frac{}{a.b}  = (a.\bar b)+(\bar a.b)

From the given parameters:

X = (a.\bar b)+(\bar a.b)

This implies that:

(a + b)\ .  \frac{}{a.b} when simplified is X or (a.\bar b)+(\bar a.b)

3 0
2 years ago
Other questions:
  • Brenda wants to finish her presentation with a summary slide . She wants three key messages to appear on each of the photo clips
    6·2 answers
  • While doing research on the Internet, what kind of website should you avoid because the information may be biased? A) .org. B) .
    15·2 answers
  • What does intergrated organization mean
    15·1 answer
  • write the algorithm, flowchart and BASIC program to calculate the area of the rectangle length 50m and width 30m.​
    8·1 answer
  • How might the website owner use theses details other than to verify login details?
    6·2 answers
  • The data type of 17.3 should be ________________.
    12·2 answers
  • E Highlight
    6·1 answer
  • Write a program that produces an expense report for a trip to Lagos, Nigeria. Use the Internet to research the cost to travel to
    13·1 answer
  • Define a query that uses the Natural Join command to join three tables to produce useful information.
    14·1 answer
  • 30 POINTS FOR THE CORRECT ANSWERS
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!