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
To what extent are surrounded species able to stand the anthropogenic activities?
julsineya [31]

Answer:

At the current rate, surrounded animal species might not be able to stand anthropogenic activities in the nearest future.

Explanation:

<em>Anthropogenic activities are those human activities that causes change in the biophysical environment, ecosystems, biodiversity, and natural resources. It also includes global warming, mass extinction of animals and loss of bio-diversity and other global disasters brought about by human activities</em>.

<em>The main driving force of anthropogenic activities is the pressure brought about by the ever growing human population</em>. The earth is overpopulated by humans, and this pushes man to maximize his environment, even to the detriment of this environment. Animal species are hunted to extinction due to increasing demand for their meat, or ornaments gotten from these animals, or some of their body parts, perceived to hold medicinal power, industrial activities poison the environment and natural resources all around, and some ecology has been destroyed and native species population decimated, just because man felt he had to control his environment, sometimes by introducing foreign species he feels he needs.

If nothing is done to halt the current rate of anthropogenic activities, by controlling human population growth, man might end up occupying the planet all alone by himself with surrounding species utterly destroyed.

3 0
3 years ago
4. What is the formula for calculating the file size?
Verizon [17]
Step 2: Multiply total number of pixels by the bit depth of the detector (16 bit, 14 bit etc.) to get the total number of bits of data. Step 3: Dividing the total number of bits by 8 equals the file size in bytes. Step 4: Divide the number of bytes by 1024 to get the file size in kilobytes.
7 0
3 years ago
In theory, a(n) _____ can be an independent centralized database management system with proper interfaces to support remote acce
Vlad [161]

Answer:

Transaction Manger

Explanation:

Transaction Manger

Transaction Manager is responsible for transaction between resources that are available. It works as interface to support remote access form other systems in Data base management system.

8 0
3 years ago
4.2: Roman Numeral Converter
dalvyx [7]

Answer:

1 I

2 II

3 III

4 IV

5 V

6 VI

7 VII

8 VIII

9 IX

10 X

6 0
3 years ago
What are the benefits of open source software? Risks?
andrezito [222]

Answer:

more security

fewer bugs and faster fixes

no upgrade pushes

low coast

excellent support

as far as the risk part of it. I think that would be

the risk of license restriction, infringement.

5 0
3 years ago
Other questions:
  • Which ipv6 static route would serve as a backup route to a dynamic route learned through ospf?
    12·1 answer
  • Using an LCD projector to show an online video to a group of people is an example of:
    14·1 answer
  • LAB:
    8·1 answer
  • Adjusting the ______ adjusts the difference in appearance between light and dark areas of the photo.​
    10·2 answers
  • Individuals who require better speed and performance for graphics-intensive applications (e.g., video editing, gaming, etc.) pre
    8·1 answer
  • Whats the best way to get into a computers programming to get past firewalls
    15·2 answers
  • What is a user interface have? Plz answer ASAP!!!!!
    15·2 answers
  • An individual involved with the aspect of a project will be concerned with budgets and the costs associated with running a busin
    10·2 answers
  • Lesson 2.7 Code Practice #2
    13·1 answer
  • How to execute python code in command prompt *window*?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!