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
Write Python code to save the data to a MongoDB collection:Import json module to parse JSON dataImport MongoClient from pymongo
Zigmanuir [339]

Answer:

Explanation:

The objective of this task is to compute a program that involves the usage of Python code to save the data to MongoDB and to query  the database.

Due to the error that occur which makes me to be unable to submit this answer, I've created a word document instead and the attached file can be found below.

Thanks!

Download docx
8 0
2 years ago
This exspansion slot essentially replaced PCI and AGP slots
MrRa [10]
PCI and AGP slots have been replaced with PCI-E slot (PCI-Express). There are different types of PCI-E buses:

PCI Express 1x (250 [500] * MB/s)
PCI Express 2x (500 [1000] * MB/s)
PCI Express 4x (1000 [2000] * MB/s)
PCI Express 8x (2000 [4000] * MB/s)
PCI Express 16x (4000 [8000] * MB/s)
<span>PCI Express 32x (8000 [16000] * MB/s)

I hope that's what you meant :)</span>
4 0
3 years ago
Which shape denotes a process to be carried out in a flowchart?
luda_lava [24]

The answer is a rectangle.

6 0
2 years ago
Read 2 more answers
This is really not a question but yall should texts me I need friends:))
noname [10]

Answer:

if ur lonely i suggest an app/website called mylol

Explanation:

fdsjafklsuhfkjfudhjkfewuhfdjk fdjs afujijf kldsaflkdjslajrfewiofjdjsahfruifhgijdsk fdsj fds

8 0
2 years ago
Read 2 more answers
Complete the statement by entering the appropriate term in the space below.
Vera_Pavlovna [14]

Answer:

Probably "compress", but these days the common answer is "upload to cloud".

Explanation:

Compressing the files is an easy way to reduce their size, unless most of the size is in already compressed, high-entropy formats (like mp3, jpeg or mp4).

The common compression format is .ZIP - you've probably seen it countless times, but other ways like RAR, 7Z are also popular, while Linux users mostly deal with tar.gz, tar.bz2 or tar.xz

On the other hand, the standard practice these days is to upload the presentation to a cloud service, like GSheets or Office PowerPoint 365, which gets rid of the limits of email filesize, while providing a convenient web-app way to view the presentation without downloading (and it doesn't clutter their inbox space or hard drives)! Alternatively, one other way to email any large file (not just a presentation) includes uploading it to some service like DropBox, GDrive or anything similar.

7 0
2 years ago
Read 2 more answers
Other questions:
  • An array name and index are separated using ____.
    13·1 answer
  • You need to perform maintenance on a router and need to temporarily reroute traffic through another office. which would be the b
    6·1 answer
  • Which of the following involves writing hidden messages so that only the sender and intended recipient know a message exists? St
    5·1 answer
  • _____ lets you look at two documents at the same time.
    14·1 answer
  • When addictions escalate and the individual loses his or her job or drops out of school, _______________.
    12·2 answers
  • There are parallels between the trust models in Kerberos and Public Key Infrastructure (PKI). When we compare them side by side,
    15·1 answer
  • MR. Tom asked her students could they plant a flower and bring it to class. Sarah brought his flower and said it was a rose. Jam
    6·1 answer
  • Write a program that reads 20 integers from the user into an array and uses a function arrayMinimum that accepts an integer arra
    5·1 answer
  • The memory used by the CPU to temporarily hold data while processing is called _______. random access memory central processing
    5·1 answer
  • CreatePolicies<br> I need help with this in java.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!