Question

Project 6-1: Email Creator Create a program that reads a file and creates a series of emails Console Email Creator jbutler@gm

In C++ please!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you have any doubts, please give me comment...

#include<iostream>

#include<fstream>

#include<sstream>

#include<cctype>

#include<string>

using namespace std;

string toLower(const string &str);

int main(){

    ifstream in;

    in.open("email_template.txt");

    if(in.fail()){

        cout<<"Unable to open email_template.txt"<<endl;

        return -1;

    }

    string line, fname, uname, email;

    string temp_copy, temp="";

    int pos;

    while(!in.eof()){

        getline(in, line);

        temp += line+"\n";

    }

    in.close();

    in.open("email_list.txt");

    if(in.fail()){

        cout<<"Unable to open email_list.txt"<<endl;

        return -1;

    }

    cout<<"Email Creator"<<endl<<endl;

    while(!in.eof()){

        getline(in, line);

        istringstream ss(line);

        getline(ss, fname, '\\');

        getline(ss, uname, '\\');

        getline(ss, email, '\\');

        fname = toLower(fname);

        fname[0] = toupper(fname[0]);

        email = toLower(email);

        temp_copy = temp;

        while((pos=temp_copy.find("{email}"))!=string::npos){

            temp_copy.replace(pos, 7, email);

        }

        while((pos=temp_copy.find("{first_name}"))!=string::npos){

            temp_copy.replace(pos, 12, fname);

        }

        cout<<"========================================================"<<endl;

        cout<<temp_copy;

    }

    in.close();

    return 0;

}

string toLower(const string &str){

    string result = "";

    for(int i=0; i<str.size(); i++){

        result += tolower(str[i]);

    }

    return result;

}

nagarajuanagaraju-Vostro-3550:15092019$ g++ email.cpp nagarajuanagaraju-Vostro-3550:15092019$ ./a.out Email Creator =========

Add a comment
Know the answer?
Add Answer to:
In C++ please! Project 6-1: Email Creator Create a program that reads a file and creates...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Java Email Template Application: Create an application that creates a series of emails as outlined below....

    Java Email Template Application: Create an application that creates a series of emails as outlined below. Create an array of email addresses that include the following data: "   james   ,butler,jbutler@hotmail.com" "Josephine,Darakjy,Josephine_Darakjy@darakjy.org" "ART,VENERE,ART@VENERE.ORG" Store a template for a mass email like this: String template =     "To:      {email}\n" +     "From:    noreply@deals.com\n" +     "Subject: Deals!\n\n" +     "Hi {first_name},\n\n" +     "We've got some great deals for you. Check our website!"; When the application starts, it should read the email...

  • I can't get the program to read from prospect.csv file and produce the correct prospect_clean.csv file....

    I can't get the program to read from prospect.csv file and produce the correct prospect_clean.csv file. Can you help with explanation to the answer? Project 15-3: File Cleaner Create an application that reads a file that contains an email list, reformats the data, and writes the cleaned list to another file. Console File Cleaner Source file:  prospects.csv Cleaned file: prospects_clean.csv Congratulations! Your file has been cleaned! The prospect.csv file FIRST,LAST,EMAIL james,butler,jbutler@gail.com Josephine,Darakjy,josephine_darakjy@darakjy.org ART,VENERE,ART@VENERE.ORG ... The prospect_clean.csv file First,Last,email James,Butler,jbutler@gail.com Josephine,Darakjy,josephine_darakjy@darakjy.org Art,Venere,art@venere.org...

  • Hello can somebody please help me with Project 15-3 File Cleaner assignment? This project is to...

    Hello can somebody please help me with Project 15-3 File Cleaner assignment? This project is to be done while using Java programming. Here are what the assignment says… Create an application that reads a file that contains an email list, reformats the data, and writes the cleaned list to another file. Below are the grading criteria… Fix formatting. The application should fix the formatting problems. Write the File. Your application should write a file named prospects_clean.csv. Use title case. All...

  • C++ There are to be two console inputs to the program, as explained below. For each input, there is to be a default val...

    C++ There are to be two console inputs to the program, as explained below. For each input, there is to be a default value, so that the user can simply press ENTER to accept any default. (That means that string will be the best choice of data type for the console input for each option.) The two console inputs are the names of the input and output files. The default filenames are to be fileContainingEmails.txt for the input file, and...

  • User Profiles Write a program that reads in a series of customer information -- including name,...

    User Profiles Write a program that reads in a series of customer information -- including name, gender, phone, email and password -- from a file and stores the information in an ArrayList of User objects. Once the information has been stored, the program should welcome a user and prompt him or her for an email and password The program should then use a linearSearch method to determine whether the user whose name and password entered match those of any of...

  • Please write this in C. Write this code in Visual Studio and upload your Source.cpp file for checking (1) Write a program to prompt the user for an output file name and 2 input file names. The progra...

    Please write this in C. Write this code in Visual Studio and upload your Source.cpp file for checking (1) Write a program to prompt the user for an output file name and 2 input file names. The program should check for errors in opening the files, and print the name of any file which has an error, and exit if an error occurs opening any of the 3 For example, (user input shown in caps in first line) Enter first...

  • C++ Guessing game. Create a project titled Lab4_Guess with a single file titled guess.cpp Program the...

    C++ Guessing game. Create a project titled Lab4_Guess with a single file titled guess.cpp Program the following game. The computer selects a random number between 1 and 100 and asks the user to guess the number. If the user guesses incorrectly, the computer advises to try larger or smaller number. The guessing repeats until the user guesses the number. The dialog should look as follows (user input is shown in bold): Guess a number between 1 and 100: 50 try...

  • C LANGUAGE PROGRAM: You have the program that creates a parent and child. They communicate via...

    C LANGUAGE PROGRAM: You have the program that creates a parent and child. They communicate via the pipe. The parent writes into the pipe and child reads the data from the pipe. All you got to is replace FILL_IN_THE_BLANK with appropriate values or function names and just type the values of each TASKS, I don't need the c program. TASK_1 = TASK_2 = TASK_3 = TASK_4 = 4 of them [ 5 points each ] -------------------------------------------------------------------------------------------- When you run the...

  • C++ language Please help. Create a small hospital system, where patients can book appointments. The program...

    C++ language Please help. Create a small hospital system, where patients can book appointments. The program should be able to take a patient’s information and the appointment that they’d like to book. It should also be able to display the patients names in order of their appointments (ascendingly). Your program should consist of: Class Person: with private variables name, ID and age. A default and a copy constructor, setters and getters and a print function. Class Patient: inherits from Person....

  • in c++ please Page 1 of 3 (PRO) Project Assignment Instructions Last Charged: 6/1/2020 Read and...

    in c++ please Page 1 of 3 (PRO) Project Assignment Instructions Last Charged: 6/1/2020 Read and follow the directions below carefully and perform the steps in the order listed. You will be solving one program as instructed and turning in your work electronically via an uploaded file within Eagle Online/Canvas and copy & paste the program to the Text Entry box as well. Make sure and check your work prior to uploading the assignment (NOTE: For Steps 1 & 2...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT