C++ changing words in a text file

use of and

Get Help With a similar task to - C++ changing words in a text file

Login to view and/or buy answers.. or post an answer
Additional Instructions:

CS211 Homework – 4 (Double Points) Total Marks: 200 points Page 1 of 2 Question 1 of 1: Word Swap: [100 marks] Write a C++ program that will swap the words Caesar and Brutus in the file “source_file.txt”. You will need to load the file “source_file.txt” and finally write the updated contents with the replaced words to the file “target_file.txt”. Successful operation should swap all occurrences of Caesar with Brutus and Brutus with Caesar. You can use functions from the cstring library. Please properly comment your code before submission. For this part of the assignment, name your source file as WordSwap_WSUID.cpp. For example, if your user ID is A999B999 name your file as WordSwap_A999B999.cpp. Expected operation : source_file.txt Contents Friends, Romans, countrymen, lend me your ears; I come to bury Caesar, not to praise him. The evil that men do lives after them; The good is oft interred with their bones; So, let it be with Caesar. The noble Brutus Hath told you Caesar was ambitious: If it were so, it was a grievous fault, And grievously hath Caesar answer’d it. Here, under leave of Brutus and the rest– For Brutus is an honorable man; So are they all, all honorable men– Come I to speak in Caesar ’s funeral. He was my friend, faithful and just to me: But Brutus says he was ambitious; And Brutus is an honorable man. He hath brought many captives home to Rome Whose ransoms did the general coffers fill: Did this in Caesar seem ambitious? When that the poor have cried, Caesar hath wept: Ambition should be made of sterner stuff: Yet Brutus says he was ambitious; And Brutus is an honorable man. You all did see that on the Lupercal I thrice presented him a kingly crown, Which he did thrice refuse: was this ambition? Yet Brutus says he was ambitious; And, sure, he is an honorable man. I speak not to disprove what Brutus spoke, But here I am to speak what I do know. You all did love him once, not without cause: What cause withholds you then, to mourn for him? O judgment! thou art fled to brutish beasts, And men have lost their reason. Bear with me; My heart is in the coffin there with Caesar, CS211 Homework – 4 (Double Points) Total Marks: 200 points Page 2 of 2 And I must pause till it come back to me. target_file.txt Contents Friends, Romans, countrymen, lend me your ears; I come to bury Brutus, not to praise him. The evil that men do lives after them; The good is oft interred with their bones; So, let it be with Brutus. The noble Caesar Hath told you Brutus was ambitious: If it were so, it was a grievous fault, And grievously hath Brutus answer’d it. Here, under leave of Caesar and the rest– For Caesar is an honorable man; So are they all, all honorable men– Come I to speak in Brutus ’s funeral. He was my friend, faithful and just to me: But Caesar says he was ambitious; And Caesar is an honorable man. He hath brought many captives home to Rome Whose ransoms did the general coffers fill: Did this in Brutus seem ambitious? When that the poor have cried, Brutus hath wept: Ambition should be made of sterner stuff: Yet Caesar says he was ambitious; And Caesar is an honorable man. You all did see that on the Lupercal I thrice presented him a kingly crown, Which he did thrice refuse: was this ambition? Yet Caesar says he was ambitious; And, sure, he is an honorable man. I speak not to disprove what Caesar spoke, But here I am to speak what I do know. You all did love him once, not without cause: What cause withholds you then, to mourn for him? O judgment! thou art fled to brutish beasts, And men have lost their reason. Bear with me; My heart is in the coffin there with Brutus, And I must pause till it come back to me. Hint • You may want to read the contents of the file one word at a time.

Friends, Romans, countrymen, lend me your ears; I come to bury Caesar , not to praise him. The evil that men do lives after them; The good is oft interred with their bones; So, let it be with Caesar. The noble Brutus Hath told you Caesar was ambitious: If it were so, it was a grievous fault, And grievously hath Caesar answer’d it. Here, under leave of Brutus and the rest– For Brutus is an honorable man; So are they all, all honorable men– Come I to speak in Caesar’s funeral. He was my friend, faithful and just to me: But Brutus says he was ambitious; And Brutus is an honorable man. He hath brought many captives home to Rome Whose ransoms did the general coffers fill: Did this in Caesar seem ambitious? When that the poor have cried, Caesar hath wept: Ambition should be made of sterner stuff: Yet Brutus says he was ambitious; And Brutus is an honorable man. You all did see that on the Lupercal I thrice presented him a kingly crown, Which he did thrice refuse: was this ambition? Yet Brutus says he was ambitious; And, sure, he is an honorable man. I speak not to disprove what Brutus spoke, But here I am to speak what I do know. You all did love him once, not without cause: What cause withholds you then, to mourn for him? O judgment! thou art fled to brutish beasts, And men have lost their reason. Bear with me; My heart is in the coffin there with Caesar , And I must pause till it come back to me.

Related Questions

Similar orders to C++ changing words in a text file
14
Views
0
Answers
c++ lab 1 intro lab
P ROBLEM STATEMENT: A review and extension of cs132: sort a file with 120 records. However, due to memory restrictions only 20 records may be placed into memory. You are to implement a “quasi” external sort CODE/DIRECTIONS: For the sake of si...
15
Views
0
Answers
Cryptography Assignment C
1. Write two programs that use some of the build-in Cryptographic APIs a. Write one C program that uses Symmetric-Key algorithm b. Write one C program that used Asymmetric-key algorithm c. Use C programming language to write your code d. Make sure tha...
5
Views
0
Answers
DFA&NFA Perl language
Question about DFA and NFA Perl programming for DFA and NFA...
9
Views
0
Answers
Python Coding Homework
Its about python implementation of linguistic computer science. Due to covid its our form of exam this year and I need it till 31st of January. There will be another one of these - maybe you could calculate the price of that one on top of that....