Computers and Technology

Write a function named clonelines that takes two parameters:

1. infile, a string, the name of an input file that exists before clonelines is called
2. outfile, a string, the name of an output file that clonelines creates and writes to

the function clonelines reads the content of infile, line by line, and writes into outfile any line that contains at least one word that occurs more than once on the line. you may assume that the input file contains only lowercase letters, spaces and newline characters.

for example, if the following is the content of the file william. txt:

double double toil and trouble fire burn and caldron bubble

eye of newt and toe of frog fillet of a fenny snake in the caldron boil and bake

double double toil and trouble fire burn and caldron bubble

the following function call:

> > > infile = 'william. txt'

> > > outfile = 'clones. txt'

> > > clonelines (infile, outfile)

should create the file clones. txt with the content:

double double toil and trouble eye of newt and toe of frog double double toil and trouble

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 19:30, 710jonathan
The following is an excerpt from a slide presentation. today we will inverse operations solving equations using inverse operations solving inequalities using inverse operations from which part of the presentation does the slide most likely come from? a. introduction b. outline c. body d. conclusion
Answers: 1
image
Computers and Technology, 22.06.2019 23:00, brooklynmikestovgphx
Suppose s, t, and w are strings that have already been created inside main. write a statement or statements, to be added to main, that will determine if the lengths of the three strings are in order by length, smallest to largest. that is, your code should determine if s is strictly shorter than t, and if t is strictly shorter than w. if these conditions hold your code should print (the boolean value) true. if not, your code should print false. (strictly means: no ties) example: if s, t, and w are "cat", "hats", and "skies" your code should print true - their lengths are 3-4-5; but if s, t, and w are "cats" "shirt", and "trust", then print false - their lengths are 4-5-5 enter your code in the box below
Answers: 2
image
Computers and Technology, 23.06.2019 02:00, mayapril813
Consider the following function main: int main() { int alpha[20]; int beta[20]; int matrix[10][4]; . . } a. write the definition of the function inputarray that prompts the user to input 20 numbers and stores the numbers into alpha. b. write the definition of the function doublearray that initializes the elements of beta to two times the corresponding elements in alpha. make sure that you prevent the function from modifying the elements of alpha. c. write the definition of the function copyalphabeta that stores alpha into the first five rows of matrix and beta into the last five rows of matrix. make sure that you prevent the function from modifying the elements of alpha and beta. d. write the definition of the function printarray that prints any onedimensional array of type int. print 15 elements per line. e. write a c11 program that tests the function main and the functions discussed in parts a through d. (add additional functions, such as printing a two-dimensional array, as needed.)
Answers: 3
image
Computers and Technology, 23.06.2019 04:31, genyjoannerubiera
This graph compares the cost of room and board at educational institutions in texas.
Answers: 1
Do you know the correct answer?
Write a function named clonelines that takes two parameters:

1. infile, a string, the...

Questions in other subjects: