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
What is also known as a visual aid in a presentation?
kap26 [50]

Answer:

Option D i.e., slide are the correct option.

Explanation:

The following option is true because in the PowerPoint presentation slide is the visual aid. With the help of the visual aid, the user can add the acumen to its PowerPoint presentation and it is the item in which the user can summarize their information and data that is slide. It is important for the creation of the official or the business purpose presentation.

3 0
4 years ago
Read 2 more answers
Why is page formatting important??​
Lorico [155]

Answer:

Perhaps one of the most important things you can learn in Microsoft Word is how to format your page with elements such as margins and page breaks. Formatting your pages makes them look more attractive and makes them easier to read.

7 0
3 years ago
Read 2 more answers
Julie: 3: 36, 6:72, 9:108....tell me the next 3 ratios * math*
svlad2 [7]

Answer:

12:144, 15:180,

Explanation:

8 0
3 years ago
the corrective actions you need to perform on a computer in case it functions in an unexpected manner is called what
Vadim26 [7]
These actions are called troubleshooting. One of the first ones would be to save your work, if you can, close all open programs and then shut down your computer (not restart). Wait a couple if minutes, start and see if the problem has been alleviated.
5 0
4 years ago
A ______ or workstation computer is typically used by one or a small number of people to perform everyday productivity tasks, su
sveta [45]

Answer:

Desktop

Explanation:

A desktop computer is a personal computing machine designed to be used on top of a usual office desk.

It accommodate in it the physical hardware that makes a computer run and connects to input devices like the mouse, monitor, and keyboard users interact with. Desktop computers are mostly used in enterprise and business environment, including in consumer use cases such as for gaming. In the enterprise, they are vital since they are the major medium for many users to do their day to day jobs.

6 0
4 years ago
Other questions:
  • To delete a note, select the note reference mark in the footnote text by dragging through the note reference mark, and then clic
    6·1 answer
  • Which trait depicts honesty?
    10·1 answer
  • Write a declaration for a class named City, which has the members cityName, a string, and position, a Location structure (declar
    10·1 answer
  • Which of the following is a valid formula?<br> (C2-D16)<br> O A2/F2<br> O=B5/10<br> O =E10
    14·1 answer
  • You want to save twenty of your vacation pictures on your computer. Which is the best place to save them?
    6·2 answers
  • C programmig : Output all combinations of character variables a, b, and c, using this ordering:abc acb bac bca cab cbaSo if a =
    12·2 answers
  • Payroll deductions are the same for all employees. True False
    12·1 answer
  • What is the output?
    11·2 answers
  • Select the correct answer. Nancy has made a small web page with the new features of HTML5. She has to show this web page in scho
    9·1 answer
  • 100 POINTS!!!!!!!!
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!