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 54663266326-737237232732773
Monica [59]

Answer:

−7.37182569×10/\14

Explanation:

8 0
3 years ago
Suppose company A wants to develop a program that duplicates the functionality of a programm by company B. Describe how company
kompoz [17]
The design of the software is covered by copy right unless it is open sourced or is a very common interface. They would need to come up with their own design and way of solving the problem to have a solution that was not copyrighted.
5 0
4 years ago
If a class contains more than one constructor, describe how the computer determines the appropriate constructor. provide an exam
notsponge [240]
If a class contains more than one constructor, computer determines the appropriate constructor by matching all the attributes, like the number, data type and position. Here's the example where the row public AirConditioner(){} is the default constructor that can use <span>default settings or initialize manually (sorry for tabulation, not my fault)</span>:
<span>class AirConditioner{   enum ConditionerMode{      Automatic,  }   public ConditionerMode Mode;   public int MinTemperature = 18;   public int MaxTemperature = 20;
   public AirConditioner(){    }
   public AirConditioner(ConditionerMode mode){       Mode = mode;   }     public AirConditioner(ConditionerMode mode, int MinTemp, int MaxTemp){      Mode = mode;      MinTemperature = MinTemp;      MaxTemperature = MaxTemp;   }}</span>
5 0
3 years ago
. Let F(X, Y, Z)=(X + Y + Z)(X + Y + Z)(X + Y + Z)(X + Y + Z). Use a 3-variable K-Map to find the minimized SOP form of this fun
Mrac [35]

Answer:

Kindly see explaination

Explanation:

The k-map van be defined as a map that provides a pictorial method of grouping together expressions with common factors and therefore eliminating unwanted variables. The Karnaugh map can also be described as a special arrangement of a truth table.

Please kindly check attachment for the 3-variable K-Map to find the minimized SOP form of the function in the question.

5 0
3 years ago
Jayden wants to take a current theme but just change a little bit of it. Complete the steps to help Jayden.
Sindrei [870]

Answer:The theme can be automatically changed via the default settings

Explanation:

4 0
3 years ago
Other questions:
  • Wrire a code that display elements at indices 1 and 4 in the follwoing array.
    12·1 answer
  • Write a program that gets a single character from the user. If the character is not a capital letter (between 'A' and 'Z'), then
    15·1 answer
  • import java.util.Scanner; public class StudentScores { public static void main (String [] args) { Scanner scnr = new Scanner(Sys
    5·1 answer
  • Having one password for all accounts is an easy way to remember passwords, but it will expose you to what risk?
    15·1 answer
  • How are logical operators used?
    14·1 answer
  • The Institute of Electrical and Electronics Engineers (IEEE) is an organization that researches and institutes electrical standa
    15·2 answers
  • Which encryption standard goes with the WPA2 protocol?<br> AES<br> DES<br> TKIP<br> WPS
    15·1 answer
  • Type the correct answer in the box.
    15·1 answer
  • Briefly the conceptual model of effective computer based instruction for adults outlining three units (output, Process and input
    9·1 answer
  • How is your mental health as you're returning to school virtually or in
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!