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
Which of the following IS true about usnig the Hatch command ?
xeze [42]

Answer:

What is the following?

Explanation:

There is no following listed, so I can't help you.

6 0
3 years ago
which of the following peripheral does not belong to a group: A) Monitor B) Printer C) Hardware D) Keyboard​
nikdorinn [45]
C hardware is the correct answer
5 0
3 years ago
Type the correct answer in the box. Use numerals instead of words. If necessary, use / for the fraction bar. What will be the ou
lord [1]

Answer:

2

Explanation:

The output of the Java program is 2. The public Vehicle class is defined with the class variable 'counter'. When a Vehicle class object is instantiated, the counter variable increments by one.

In the program, the two instances of the class are created, incrementing the counter variable to two, the print statement outputs 2 as the result of the program.

8 0
3 years ago
Company Wizzy is having trouble with network security. Issues with authentication, viruses, malware/spyware, and other network i
Darya [45]

Answer:

B) security as a service I'm just doing the work

4 0
3 years ago
Just admit it. You have more than one account on brainly. If not several you have one where you have a bad reputation and anothe
Paha777 [63]

Answer:

No I don't this is my only account ;-;

Explanation:

But I have considered making a new one but for now this is my only account lolll although it does seem to make good sense when it comes to having a bad reputation on the other account. why haven't I thought about that- see how slow I am dang g , I am dummer that I thought I was..Imaoo

3 0
2 years ago
Read 2 more answers
Other questions:
  • Proxy data:
    12·1 answer
  • which virtue you need to secure information by limiting computer access to authorized personnel only?
    10·1 answer
  • The series of events that make up a story is called
    6·2 answers
  • You resurrected an old worksheet. It appears to contain most of the information that you need, but not all of it. Which step sho
    5·1 answer
  • Downloading files is safe for most types of files except Select one: a. documents. b. pictures. c. executable files. d. music fi
    7·1 answer
  • When Judy logged on the network, she faced the message requesting that she changes her password. So, she changed her password. B
    10·1 answer
  • I need help with writing the code in Python that draws an arrow pointing to the right.
    15·1 answer
  • A type of multiprocessor chip that provides two or more separate and independent CPUs.
    8·1 answer
  • Why do Selection Sort and Insertion Sort’s outer loops run 11 iterations if there are 12 elements in the array?
    7·1 answer
  • Use the drop-down menus to describe the customize ribbon dialog box.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!