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
How does polymorphism enable you to program "in the general" rather than "in the specific"? Discuss the key advantages of progra
barxatty [35]

Answer:

Explanation:

When programming in an OOP language classes are created to represent real-life objects, people, places etc. from the real world. Programming in the general allows you to cut down your code and making it more efficient by applying the same necessary functions to all of the objects that classify under the same category. For example by programming "in the general" and creating an Animal class you can create all of the functions/behaviors that animals tend to have. Then you can apply these functions/behaviors to various animals such as a Cat, Dog, Horse, etc. But if you program in the specific you cannot apply a Cat class to a Dog since they are not the same thing.

4 0
2 years ago
Which of the following processes allows animators to use computers to input human movement that can later be transformed to crea
nadya68 [22]
Motion Capture. "it's a combination of rotoscoping with newer computer technology, allowing people to use live footage as the basis for animation without having to go through the process of drawing over it." -scienceworld .ca
7 0
2 years ago
Read 2 more answers
What are other ways you could use the shake or compass code blocks in physical computing projects?
sashaice [31]

Answer:

Explanation:

there are different ways of quick navigation between files and functions. ... You should use the menu 'Remove file from project' instead of deleting files. ... A Makefile generation tool for Code::Blocks IDE by Mirai Computing

3 0
3 years ago
Read 2 more answers
All digital devices use software programs to function. Software <br> BLANK create these programs.
yarga [219]
Application I think because software used to create a program is called application software I'm not entirely sure about that though
7 0
3 years ago
Compose an e-mail to your coworker Adam that describes how to add a photograph to a slide.
pantera1 [17]

The ways to add a photograph to a slide is given below: What to write when composing the email is also given below.

<h3>How do you Insert photos into a slide?</h3>

The steps are given below?\

  • The first thing to do is to open  the slide you want to insert the image on.
  • then click on Insert menu, and take the cursor to the Picture, and then one can click Photo Browser or insert pictures.
  • Then select the picture that you want and and one can drag it onto the slide.

Note that it is essential to follow the steps and one can add as many pictures as they want to their slides.

Learn more about e-mail from

brainly.com/question/24506250

#SPJ1

3 0
2 years ago
Other questions:
  • 2. Write the binary representation of number 1037.379 in IEEE 754 standard in single precision. Express the result in binary, oc
    7·1 answer
  • Why is it important to evaluate the website on which you plan to shop?
    11·2 answers
  • What are the cause of eye strain during computer usage?
    7·1 answer
  • How does scarcity affect what gets produced
    5·1 answer
  • An Einstein Analytics team wants to create a dashboard that displays values from an external, on-premise Oracle Database. What a
    7·1 answer
  • Which format is best for the image below?
    12·1 answer
  • A(n) ____ instruction might look like a meaningless string of 0s and 1s, but it actually represents specific operations and stor
    9·1 answer
  • Concentric circles on a disk platter where data is stored;________
    8·1 answer
  • Krya needs help deciding which colors she should use on her web page. What can she use to help her decide.
    11·1 answer
  • Could you give me Aidan Gallagher's wuasp number​
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!