SlideShare a Scribd company logo
Write a C++ program that reads in a list of first and last names from an input data file named
people.txt. The program should create a user name for each person consisting of the last name
and the first initial of the first name. The program should print the first name, the last name, and
the created user name for each person to the output data file usernames.txt. The program must
use an end-of-file (EOF) loop.
Solution
people.txt (Save this file under D Drive .Then the path of the file pointing to it is D:people.txt)
Willaims Kane
Johnson Mitchel
Sachin Tendulkar
Vinod kamblie
Sanjay Manjrekar
Ravi sastri
Ricky Pointing
Clarke Michael
_____________________
code:
#include
#include
#include
#include
using namespace std;
int main()
{
//Declaring variables
string fname,lname;
string uname;
int index=0;
//defines an input stream for the data file
ifstream dataIn;
//Defines an output stream for the data file
ofstream dataOut;
//Opening the input file
dataIn.open("D:people.txt");
//creating and Opening the output file
dataOut.open("D:usernames.txt");
//This loop continues to execute until the end of the file
while (!dataIn.eof( ))
{
//reading the firstname and lastname from people.txt file
dataIn>>fname>>lname;
//Concatinating the firstname first letter with the lastname
uname=lname+fname.at(index);
//Storing the user name in the txt file
dataOut<

More Related Content

Similar to Write a C++ program that reads in a list of first and last names fro.pdf

C++ Help FilestreamWrite a program that reads the values from a f.pdf
C++ Help FilestreamWrite a program that reads the values from a f.pdfC++ Help FilestreamWrite a program that reads the values from a f.pdf
C++ Help FilestreamWrite a program that reads the values from a f.pdf
Mujeeb76
 
new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...
new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...
new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...
AzanMehdi
 
Basics of files and its functions with example
Basics of files and its functions with exampleBasics of files and its functions with example
Basics of files and its functions with example
Sunil Patel
 
Filesinc 130512002619-phpapp01
Filesinc 130512002619-phpapp01Filesinc 130512002619-phpapp01
Filesinc 130512002619-phpapp01
Rex Joe
 
Files in c++
Files in c++Files in c++
Files in c++
Selvin Josy Bai Somu
 
Basics of file handling
Basics of file handlingBasics of file handling
Basics of file handlingpinkpreet_kaur
 
basics of file handling
basics of file handlingbasics of file handling
basics of file handlingpinkpreet_kaur
 
Csc1100 lecture15 ch09
Csc1100 lecture15 ch09Csc1100 lecture15 ch09
Csc1100 lecture15 ch09IIUM
 
File handling in_c
File handling in_cFile handling in_c
File handling in_c
sanya6900
 
Unix lab
Unix labUnix lab
File management in C++
File management in C++File management in C++
File management in C++
apoorvaverma33
 
ExtraFileIO.pptx
ExtraFileIO.pptxExtraFileIO.pptx
ExtraFileIO.pptx
NguynThiThanhTho
 
Srgoc dotnet
Srgoc dotnetSrgoc dotnet
Srgoc dotnet
Gaurav Singh
 
C++ppt.pptx
C++ppt.pptxC++ppt.pptx
C++ppt.pptx
MrGyanprakash
 
source code which create file and write into it
source code which create file and write into itsource code which create file and write into it
source code which create file and write into it
melakusisay507
 
srgoc
srgocsrgoc
Hi, I need help with a java programming project. specifically practi.pdf
Hi, I need help with a java programming project. specifically practi.pdfHi, I need help with a java programming project. specifically practi.pdf
Hi, I need help with a java programming project. specifically practi.pdf
PRATIKSINHA7304
 
file handling final3333.pptx
file handling final3333.pptxfile handling final3333.pptx
file handling final3333.pptx
radhushri
 
Stream classes in C++
Stream classes in C++Stream classes in C++
Stream classes in C++
Shyam Gupta
 
Criminal Record System
Criminal Record SystemCriminal Record System
Criminal Record System
Cool Guy
 

Similar to Write a C++ program that reads in a list of first and last names fro.pdf (20)

C++ Help FilestreamWrite a program that reads the values from a f.pdf
C++ Help FilestreamWrite a program that reads the values from a f.pdfC++ Help FilestreamWrite a program that reads the values from a f.pdf
C++ Help FilestreamWrite a program that reads the values from a f.pdf
 
new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...
new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...
new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...
 
Basics of files and its functions with example
Basics of files and its functions with exampleBasics of files and its functions with example
Basics of files and its functions with example
 
Filesinc 130512002619-phpapp01
Filesinc 130512002619-phpapp01Filesinc 130512002619-phpapp01
Filesinc 130512002619-phpapp01
 
Files in c++
Files in c++Files in c++
Files in c++
 
Basics of file handling
Basics of file handlingBasics of file handling
Basics of file handling
 
basics of file handling
basics of file handlingbasics of file handling
basics of file handling
 
Csc1100 lecture15 ch09
Csc1100 lecture15 ch09Csc1100 lecture15 ch09
Csc1100 lecture15 ch09
 
File handling in_c
File handling in_cFile handling in_c
File handling in_c
 
Unix lab
Unix labUnix lab
Unix lab
 
File management in C++
File management in C++File management in C++
File management in C++
 
ExtraFileIO.pptx
ExtraFileIO.pptxExtraFileIO.pptx
ExtraFileIO.pptx
 
Srgoc dotnet
Srgoc dotnetSrgoc dotnet
Srgoc dotnet
 
C++ppt.pptx
C++ppt.pptxC++ppt.pptx
C++ppt.pptx
 
source code which create file and write into it
source code which create file and write into itsource code which create file and write into it
source code which create file and write into it
 
srgoc
srgocsrgoc
srgoc
 
Hi, I need help with a java programming project. specifically practi.pdf
Hi, I need help with a java programming project. specifically practi.pdfHi, I need help with a java programming project. specifically practi.pdf
Hi, I need help with a java programming project. specifically practi.pdf
 
file handling final3333.pptx
file handling final3333.pptxfile handling final3333.pptx
file handling final3333.pptx
 
Stream classes in C++
Stream classes in C++Stream classes in C++
Stream classes in C++
 
Criminal Record System
Criminal Record SystemCriminal Record System
Criminal Record System
 

More from ramasamyarm

Cell Structure Concept Map FUNDAMENTAL UNITOF LIFE that serve as FUNC.pdf
Cell Structure Concept Map FUNDAMENTAL UNITOF LIFE that serve as FUNC.pdfCell Structure Concept Map FUNDAMENTAL UNITOF LIFE that serve as FUNC.pdf
Cell Structure Concept Map FUNDAMENTAL UNITOF LIFE that serve as FUNC.pdf
ramasamyarm
 
At the end of this lecture you should be able to define bioremediatio.pdf
At the end of this lecture you should be able to define bioremediatio.pdfAt the end of this lecture you should be able to define bioremediatio.pdf
At the end of this lecture you should be able to define bioremediatio.pdf
ramasamyarm
 
Are humans influencing evolution or is evolution influencing us Do .pdf
Are humans influencing evolution or is evolution influencing us Do .pdfAre humans influencing evolution or is evolution influencing us Do .pdf
Are humans influencing evolution or is evolution influencing us Do .pdf
ramasamyarm
 
Adaptive radiation has resulted in high morphological diversity amon.pdf
Adaptive radiation has resulted in high morphological diversity amon.pdfAdaptive radiation has resulted in high morphological diversity amon.pdf
Adaptive radiation has resulted in high morphological diversity amon.pdf
ramasamyarm
 
a) Create a list of business functional requirements that the system .pdf
a) Create a list of business functional requirements that the system .pdfa) Create a list of business functional requirements that the system .pdf
a) Create a list of business functional requirements that the system .pdf
ramasamyarm
 
You have just set up a Windows 7 computer for a home customer and co.pdf
You have just set up a Windows 7 computer for a home customer and co.pdfYou have just set up a Windows 7 computer for a home customer and co.pdf
You have just set up a Windows 7 computer for a home customer and co.pdf
ramasamyarm
 
“Examine the life of an individual whom you believe exemplifies the .pdf
“Examine the life of an individual whom you believe exemplifies the .pdf“Examine the life of an individual whom you believe exemplifies the .pdf
“Examine the life of an individual whom you believe exemplifies the .pdf
ramasamyarm
 
While federal funding of primary and secondary education and federal.pdf
While federal funding of primary and secondary education and federal.pdfWhile federal funding of primary and secondary education and federal.pdf
While federal funding of primary and secondary education and federal.pdf
ramasamyarm
 
Which of the following would provide the best evidence that an early.pdf
Which of the following would provide the best evidence that an early.pdfWhich of the following would provide the best evidence that an early.pdf
Which of the following would provide the best evidence that an early.pdf
ramasamyarm
 
Which of the following are parts do all seeds have in common Choose .pdf
Which of the following are parts do all seeds have in common Choose .pdfWhich of the following are parts do all seeds have in common Choose .pdf
Which of the following are parts do all seeds have in common Choose .pdf
ramasamyarm
 
Where can the medians of a triangle intersect I. inside the tri.pdf
Where can the medians of a triangle intersect I. inside the tri.pdfWhere can the medians of a triangle intersect I. inside the tri.pdf
Where can the medians of a triangle intersect I. inside the tri.pdf
ramasamyarm
 
What are the limitations of using traditional Value Stream Mapping (V.pdf
What are the limitations of using traditional Value Stream Mapping (V.pdfWhat are the limitations of using traditional Value Stream Mapping (V.pdf
What are the limitations of using traditional Value Stream Mapping (V.pdf
ramasamyarm
 
What is the largest regular number less than 100 (See problem study.pdf
What is the largest regular number less than 100 (See problem study.pdfWhat is the largest regular number less than 100 (See problem study.pdf
What is the largest regular number less than 100 (See problem study.pdf
ramasamyarm
 
What is anatomical position and why is it important in the study of h.pdf
What is anatomical position and why is it important in the study of h.pdfWhat is anatomical position and why is it important in the study of h.pdf
What is anatomical position and why is it important in the study of h.pdf
ramasamyarm
 
Solve all questions on page pleaseWill rate, thank you Mtaich the .pdf
Solve all questions on page pleaseWill rate, thank you Mtaich the .pdfSolve all questions on page pleaseWill rate, thank you Mtaich the .pdf
Solve all questions on page pleaseWill rate, thank you Mtaich the .pdf
ramasamyarm
 
A heterozygote has a ------for a trait being studiedSolutionA .pdf
A heterozygote has a ------for a trait being studiedSolutionA .pdfA heterozygote has a ------for a trait being studiedSolutionA .pdf
A heterozygote has a ------for a trait being studiedSolutionA .pdf
ramasamyarm
 
Prove that if a is an upper bound for A, and if a is also an element .pdf
Prove that if a is an upper bound for A, and if a is also an element .pdfProve that if a is an upper bound for A, and if a is also an element .pdf
Prove that if a is an upper bound for A, and if a is also an element .pdf
ramasamyarm
 
PYTHON Using the file object input, write code that read an integer.pdf
PYTHON Using the file object input, write code that read an integer.pdfPYTHON Using the file object input, write code that read an integer.pdf
PYTHON Using the file object input, write code that read an integer.pdf
ramasamyarm
 
Probability - Conditional Probability for any two eventsthe equati.pdf
Probability - Conditional Probability for any two eventsthe equati.pdfProbability - Conditional Probability for any two eventsthe equati.pdf
Probability - Conditional Probability for any two eventsthe equati.pdf
ramasamyarm
 
Please choose the correct answer. Severity of symptoms of cystic fib.pdf
Please choose the correct answer. Severity of symptoms of cystic fib.pdfPlease choose the correct answer. Severity of symptoms of cystic fib.pdf
Please choose the correct answer. Severity of symptoms of cystic fib.pdf
ramasamyarm
 

More from ramasamyarm (20)

Cell Structure Concept Map FUNDAMENTAL UNITOF LIFE that serve as FUNC.pdf
Cell Structure Concept Map FUNDAMENTAL UNITOF LIFE that serve as FUNC.pdfCell Structure Concept Map FUNDAMENTAL UNITOF LIFE that serve as FUNC.pdf
Cell Structure Concept Map FUNDAMENTAL UNITOF LIFE that serve as FUNC.pdf
 
At the end of this lecture you should be able to define bioremediatio.pdf
At the end of this lecture you should be able to define bioremediatio.pdfAt the end of this lecture you should be able to define bioremediatio.pdf
At the end of this lecture you should be able to define bioremediatio.pdf
 
Are humans influencing evolution or is evolution influencing us Do .pdf
Are humans influencing evolution or is evolution influencing us Do .pdfAre humans influencing evolution or is evolution influencing us Do .pdf
Are humans influencing evolution or is evolution influencing us Do .pdf
 
Adaptive radiation has resulted in high morphological diversity amon.pdf
Adaptive radiation has resulted in high morphological diversity amon.pdfAdaptive radiation has resulted in high morphological diversity amon.pdf
Adaptive radiation has resulted in high morphological diversity amon.pdf
 
a) Create a list of business functional requirements that the system .pdf
a) Create a list of business functional requirements that the system .pdfa) Create a list of business functional requirements that the system .pdf
a) Create a list of business functional requirements that the system .pdf
 
You have just set up a Windows 7 computer for a home customer and co.pdf
You have just set up a Windows 7 computer for a home customer and co.pdfYou have just set up a Windows 7 computer for a home customer and co.pdf
You have just set up a Windows 7 computer for a home customer and co.pdf
 
“Examine the life of an individual whom you believe exemplifies the .pdf
“Examine the life of an individual whom you believe exemplifies the .pdf“Examine the life of an individual whom you believe exemplifies the .pdf
“Examine the life of an individual whom you believe exemplifies the .pdf
 
While federal funding of primary and secondary education and federal.pdf
While federal funding of primary and secondary education and federal.pdfWhile federal funding of primary and secondary education and federal.pdf
While federal funding of primary and secondary education and federal.pdf
 
Which of the following would provide the best evidence that an early.pdf
Which of the following would provide the best evidence that an early.pdfWhich of the following would provide the best evidence that an early.pdf
Which of the following would provide the best evidence that an early.pdf
 
Which of the following are parts do all seeds have in common Choose .pdf
Which of the following are parts do all seeds have in common Choose .pdfWhich of the following are parts do all seeds have in common Choose .pdf
Which of the following are parts do all seeds have in common Choose .pdf
 
Where can the medians of a triangle intersect I. inside the tri.pdf
Where can the medians of a triangle intersect I. inside the tri.pdfWhere can the medians of a triangle intersect I. inside the tri.pdf
Where can the medians of a triangle intersect I. inside the tri.pdf
 
What are the limitations of using traditional Value Stream Mapping (V.pdf
What are the limitations of using traditional Value Stream Mapping (V.pdfWhat are the limitations of using traditional Value Stream Mapping (V.pdf
What are the limitations of using traditional Value Stream Mapping (V.pdf
 
What is the largest regular number less than 100 (See problem study.pdf
What is the largest regular number less than 100 (See problem study.pdfWhat is the largest regular number less than 100 (See problem study.pdf
What is the largest regular number less than 100 (See problem study.pdf
 
What is anatomical position and why is it important in the study of h.pdf
What is anatomical position and why is it important in the study of h.pdfWhat is anatomical position and why is it important in the study of h.pdf
What is anatomical position and why is it important in the study of h.pdf
 
Solve all questions on page pleaseWill rate, thank you Mtaich the .pdf
Solve all questions on page pleaseWill rate, thank you Mtaich the .pdfSolve all questions on page pleaseWill rate, thank you Mtaich the .pdf
Solve all questions on page pleaseWill rate, thank you Mtaich the .pdf
 
A heterozygote has a ------for a trait being studiedSolutionA .pdf
A heterozygote has a ------for a trait being studiedSolutionA .pdfA heterozygote has a ------for a trait being studiedSolutionA .pdf
A heterozygote has a ------for a trait being studiedSolutionA .pdf
 
Prove that if a is an upper bound for A, and if a is also an element .pdf
Prove that if a is an upper bound for A, and if a is also an element .pdfProve that if a is an upper bound for A, and if a is also an element .pdf
Prove that if a is an upper bound for A, and if a is also an element .pdf
 
PYTHON Using the file object input, write code that read an integer.pdf
PYTHON Using the file object input, write code that read an integer.pdfPYTHON Using the file object input, write code that read an integer.pdf
PYTHON Using the file object input, write code that read an integer.pdf
 
Probability - Conditional Probability for any two eventsthe equati.pdf
Probability - Conditional Probability for any two eventsthe equati.pdfProbability - Conditional Probability for any two eventsthe equati.pdf
Probability - Conditional Probability for any two eventsthe equati.pdf
 
Please choose the correct answer. Severity of symptoms of cystic fib.pdf
Please choose the correct answer. Severity of symptoms of cystic fib.pdfPlease choose the correct answer. Severity of symptoms of cystic fib.pdf
Please choose the correct answer. Severity of symptoms of cystic fib.pdf
 

Recently uploaded

1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 

Recently uploaded (20)

1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 

Write a C++ program that reads in a list of first and last names fro.pdf

  • 1. Write a C++ program that reads in a list of first and last names from an input data file named people.txt. The program should create a user name for each person consisting of the last name and the first initial of the first name. The program should print the first name, the last name, and the created user name for each person to the output data file usernames.txt. The program must use an end-of-file (EOF) loop. Solution people.txt (Save this file under D Drive .Then the path of the file pointing to it is D:people.txt) Willaims Kane Johnson Mitchel Sachin Tendulkar Vinod kamblie Sanjay Manjrekar Ravi sastri Ricky Pointing Clarke Michael _____________________ code: #include #include #include #include using namespace std; int main() { //Declaring variables string fname,lname; string uname; int index=0; //defines an input stream for the data file ifstream dataIn;
  • 2. //Defines an output stream for the data file ofstream dataOut; //Opening the input file dataIn.open("D:people.txt"); //creating and Opening the output file dataOut.open("D:usernames.txt"); //This loop continues to execute until the end of the file while (!dataIn.eof( )) { //reading the firstname and lastname from people.txt file dataIn>>fname>>lname; //Concatinating the firstname first letter with the lastname uname=lname+fname.at(index); //Storing the user name in the txt file dataOut<