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
Certain files, such as the ____ and Security log in Windows, might lose essential network activity records if power is terminate
Hoochie [10]

Answer:

The answer to this question is a. Event log

Explanation:

Event log in Windows is a comprehensive record of security,system and application notifications stored by the Windows and it is used by administrators to determine problems in the system and foretell issues that going to happen in future.

Operating system and the Apps use event logs to keep account of important software and hardware activity that administrator can use to correct issues with the operating system.

7 0
3 years ago
Windows Rights Management Services is used in conjunction with which Microsoft applications?
Mariana [72]
“Word” is your answer
6 0
2 years ago
What are two types of organizational structures designed to help an organization achieve its goals and objectives?
Fittoniya [83]

The answer is entrepreneurial and bureaucratic. Organizations that are large and small can achieve higher sales and other profit by properly matching their needs with the structure they use to operate.   the structure of an organization can help or hinder its progress toward accomplishing these goals and This are specific set up of organizations and ways to accomplish different goals. 

4 0
3 years ago
Read 2 more answers
How desktop case or chassis designed?, material and steps?​
MariettaO [177]

They may require things such as plastic cut outs and glass depending if you want to be able to have a window to look into the pc. Some cases are 3D Printed although they have to be joined by screws at the end due to the fact that one whole print can take over a week and then it has to be well doesn't but looks better when sanded.

3 0
1 year ago
A user on a home network needs to boost the signal of the wireless router. What should the user purchase to accomplish this?
alexira [117]

Answer:

Repeater

Explanation:

Repeater is the device that is used in networking to enhance or boost the signal to increase the range of the signal.

So the user should purchase the Repeater to boost the wireless signal.

6 0
2 years ago
Other questions:
  • The equipment that processes data in order to create information is called the _______.
    8·2 answers
  • What is one course of action available in every problem solving process?
    9·2 answers
  • Which sentences in the passage correctly describe a function?
    11·1 answer
  • Fill the validateForm function to check that the phone number contains a number (use the isNaN function) and that the user name
    8·1 answer
  • Elwin Osbourne, CIO at GFS, Inc., is studying employee use of GFS e-mail for non-business communications. He plans to use a 98%
    6·1 answer
  • An invisible path determining the way of travel from one place to another.
    10·1 answer
  • Help me plzzzz ASAP T-T and it's Cyber Security but my last day of school is tomorrow and I'll graduate in June 24 so plzzzzz I
    12·1 answer
  • What can happen if you do not follow the directions of medicine or the directions from the doctor? (Give 4 examples)​
    15·1 answer
  • _________ can be used to provide access control, confidentiality, data origin authentication, connectionless integrity, rejectio
    12·1 answer
  • security investigators discovered that after attackers exploited a database server, they identified the password for the sa acco
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!