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
Contact [7]
3 years ago
14

Write a program to generate personalized junk mail. The program takes input both from an input file and from the keyboard.The in

put file contains the text of a letter, except that the name of the recipient is indicated by the three characters #N#. The program asks the user for a name and then writes the letter to a second file but with the three letters #N# replaces by the name. The three-letter string #N# will occur multiple times in the letter. Only the first name of the recipient is required You can ask the user to input the file name, or hard code the file name. you should write a function that reads from the file contains the body and writes to junk mail file
Computers and Technology
1 answer:
Evgesh-ka [11]3 years ago
7 0

Answer:

#include <iostream>

#include <fstream>

using namespace std;

void replace(ifstream&,ofstream&);

int main()

{char filename[30];

bool found=false;

cout<<"what is the name of the input file youare using? ";

cin>>filename;

ifstream input;

ofstream output;

input.open(filename);    

if(input.fail())

{ cout<<"file did notopen please check it\n";

system("pause");

return 1;

}

cout<<"what is the name of theoutput file you are using? ";

cin>>filename;

cin.ignore(100,'\n');

output.open(filename);

replace(input,output);

 

input.close();

output.close();

system("pause");

return 0;

}

void replace(ifstream& in,ofstream& out)    

{bool found=false;

string lookfor="#N#";

string data,name;

int n;

getline(in,data);

while(in)

{if(!found)

{n=data.find(lookfor,0);

if(n!=-1)

{found=true;

cout<<"Enter name: ";

getline(cin,name);

data.replace(n,3,name);

}    

}

out<<data<<endlu;

getline(in,data);

}

}

You might be interested in
My duties included reviewing
ycow [4]

Answer:

Please check the explanation.

Explanation:

I carried my logical and administrative skills to stand in implementing the succeeding tasks allocated to me:

  • swotting acquiring trends
  • investigating client data
  • concocting yearly inclination reports.

The bullets and numbering and proper indentation make the reading stuff more easily understandable. And that is what we have done above.

4 0
3 years ago
The advantage of an electronic ____ is that the content can be easily edited and updated to reflect changing financial condition
Lana71 [14]
Computer.................................
6 0
3 years ago
안녕 또 나야 난 너에게 미래의 메시지를 전하러 왔어 01100011 01101111 01101101 01101111 00100000 01111001 00100000 01101100 01101111 00100000 01101101
sashaice [31]

Answer:

i think its 01100001

Explanation:

4 0
3 years ago
Read 2 more answers
How do I get my text box to stop moving continuously on a Chromebook?
pickupchik [31]

Answer:

Go to Settings. Click on Advanced Settings. Scroll down to the Accessibility section. Make sure that the box next to “Automatically click when the mouse pointer stops” is Unchecked.

Explanation:

here you go hope this helps!!

5 0
3 years ago
Read 2 more answers
All of the following are tips for a great presentation except
Burka [1]

Answer: B. Use a variety of animations on most slides to keep your audiences attention.

Explanation:

While animations can serve as a tool to make your presentation more engaging, too many of them can end up being a distraction and can end up potentially frustrating the audience.

5 0
3 years ago
Read 2 more answers
Other questions:
  • A level breach of security could be expected to have a severe or catastrophic adverse effect on organizational operations, organ
    12·1 answer
  • Which troubleshooting tool enables you to connect to a user's remote computer, view and interact with the user's screen, and cha
    8·1 answer
  • How does the occupational outlook affect the monetary benefits of a career
    11·1 answer
  • On laptops with a smart card reader installed, where is the smart card reader usually located?
    5·1 answer
  • If you create an object using Java’s BigDecimal class, and then perform a division that results in a non-terminating decimal div
    8·1 answer
  • The first step in the five-step process for problem solving is to ____. evaluate take action understand the task or need complet
    10·2 answers
  • A cell in a spreadsheet can contain _________?
    12·1 answer
  • How do i find the greatest common factor of two numbers?
    14·1 answer
  • What do people do when they navigate using GPS
    6·2 answers
  • How can edge computing be used to increase sustainability
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!