SlideShare a Scribd company logo
Simple C++ Programming: Multiple Files
1030Prob2a.txt:
1030Prob2b.txt:
Solution
#include
#include
using namespace std;
int main()
{
ofstream outputFile;
outputFile.open ("sum.txt");
ifstream inputFile1;
inputFile1.open("1030Prob2a.txt");
ifstream inputFile2;
inputFile2.open("1030Prob2b.txt");
double n1, n2;
if (inputFile1.is_open() && inputFile2.is_open()) {
while (!inputFile1.eof() || !inputFile2.eof()) {
n1 = 0;
n2 =0;
inputFile1 >> n1;
inputFile2 >> n2;
outputFile << (n1 + n2)<

More Related Content

More from archgeetsenterprises

Glial cells were originally thought to play a very minor role in the .pdf
Glial cells were originally thought to play a very minor role in the .pdfGlial cells were originally thought to play a very minor role in the .pdf
Glial cells were originally thought to play a very minor role in the .pdf
archgeetsenterprises
 
Fungal reproductive cycle. Place the appropriate label in the correct.pdf
Fungal reproductive cycle. Place the appropriate label in the correct.pdfFungal reproductive cycle. Place the appropriate label in the correct.pdf
Fungal reproductive cycle. Place the appropriate label in the correct.pdf
archgeetsenterprises
 
Explain the concept of distributive justiceSolutiondistributiv.pdf
Explain the concept of distributive justiceSolutiondistributiv.pdfExplain the concept of distributive justiceSolutiondistributiv.pdf
Explain the concept of distributive justiceSolutiondistributiv.pdf
archgeetsenterprises
 
Fecal-oral infections are often a result of _____ droplet transmissi.pdf
Fecal-oral infections are often a result of _____  droplet transmissi.pdfFecal-oral infections are often a result of _____  droplet transmissi.pdf
Fecal-oral infections are often a result of _____ droplet transmissi.pdf
archgeetsenterprises
 
Dr. Z conducts a study examining the effect of socioeconomic status .pdf
Dr. Z conducts a study examining the effect of socioeconomic status .pdfDr. Z conducts a study examining the effect of socioeconomic status .pdf
Dr. Z conducts a study examining the effect of socioeconomic status .pdf
archgeetsenterprises
 
Double branded DNA viruses (select only one answer) all insert their.pdf
Double branded DNA viruses (select only one answer)  all insert their.pdfDouble branded DNA viruses (select only one answer)  all insert their.pdf
Double branded DNA viruses (select only one answer) all insert their.pdf
archgeetsenterprises
 
Discuss the mechanisms by which antibiotic resistance genes can be h.pdf
Discuss the mechanisms by which antibiotic resistance genes can be h.pdfDiscuss the mechanisms by which antibiotic resistance genes can be h.pdf
Discuss the mechanisms by which antibiotic resistance genes can be h.pdf
archgeetsenterprises
 
Develop two biologically relevant and researchable questions comparin.pdf
Develop two biologically relevant and researchable questions comparin.pdfDevelop two biologically relevant and researchable questions comparin.pdf
Develop two biologically relevant and researchable questions comparin.pdf
archgeetsenterprises
 
Describe two methods for communicating the material in an Informatio.pdf
Describe two methods for communicating the material in an Informatio.pdfDescribe two methods for communicating the material in an Informatio.pdf
Describe two methods for communicating the material in an Informatio.pdf
archgeetsenterprises
 
Describe the following structuresfunctions or cells Dermal, vascul.pdf
Describe the following structuresfunctions or cells  Dermal, vascul.pdfDescribe the following structuresfunctions or cells  Dermal, vascul.pdf
Describe the following structuresfunctions or cells Dermal, vascul.pdf
archgeetsenterprises
 
Describe the accounting and finance structure in an organization..pdf
Describe the accounting and finance structure in an organization..pdfDescribe the accounting and finance structure in an organization..pdf
Describe the accounting and finance structure in an organization..pdf
archgeetsenterprises
 
Consider an assembly of thousands of people, all screaming, yelling,.pdf
Consider an assembly of thousands of people, all screaming, yelling,.pdfConsider an assembly of thousands of people, all screaming, yelling,.pdf
Consider an assembly of thousands of people, all screaming, yelling,.pdf
archgeetsenterprises
 
Concrete and cementI) Give an example of non-calcium silicate cem.pdf
Concrete and cementI) Give an example of non-calcium silicate cem.pdfConcrete and cementI) Give an example of non-calcium silicate cem.pdf
Concrete and cementI) Give an example of non-calcium silicate cem.pdf
archgeetsenterprises
 
Compute the total interest and the monthly payments for an add-on i.pdf
Compute the total interest and the monthly payments for an add-on i.pdfCompute the total interest and the monthly payments for an add-on i.pdf
Compute the total interest and the monthly payments for an add-on i.pdf
archgeetsenterprises
 
Compare the views of Piaget and Vygotsky on school instruction in ab.pdf
Compare the views of Piaget and Vygotsky on school instruction in ab.pdfCompare the views of Piaget and Vygotsky on school instruction in ab.pdf
Compare the views of Piaget and Vygotsky on school instruction in ab.pdf
archgeetsenterprises
 
Can molds be unicellular If so, in what conditions and under what c.pdf
Can molds be unicellular If so, in what conditions and under what c.pdfCan molds be unicellular If so, in what conditions and under what c.pdf
Can molds be unicellular If so, in what conditions and under what c.pdf
archgeetsenterprises
 
Calculate the following cross exchange ratesThe dollar is trading.pdf
Calculate the following cross exchange ratesThe dollar is trading.pdfCalculate the following cross exchange ratesThe dollar is trading.pdf
Calculate the following cross exchange ratesThe dollar is trading.pdf
archgeetsenterprises
 
Bouchard Companys stock sells for $21 per share, its last dividen.pdf
Bouchard Companys stock sells for $21 per share, its last dividen.pdfBouchard Companys stock sells for $21 per share, its last dividen.pdf
Bouchard Companys stock sells for $21 per share, its last dividen.pdf
archgeetsenterprises
 
Answer the following question please.The answers I have is wrong, .pdf
Answer the following question please.The answers I have is wrong, .pdfAnswer the following question please.The answers I have is wrong, .pdf
Answer the following question please.The answers I have is wrong, .pdf
archgeetsenterprises
 
a) Research information about the U.S. Governments bailouts. Locat.pdf
a) Research information about the U.S. Governments bailouts. Locat.pdfa) Research information about the U.S. Governments bailouts. Locat.pdf
a) Research information about the U.S. Governments bailouts. Locat.pdf
archgeetsenterprises
 

More from archgeetsenterprises (20)

Glial cells were originally thought to play a very minor role in the .pdf
Glial cells were originally thought to play a very minor role in the .pdfGlial cells were originally thought to play a very minor role in the .pdf
Glial cells were originally thought to play a very minor role in the .pdf
 
Fungal reproductive cycle. Place the appropriate label in the correct.pdf
Fungal reproductive cycle. Place the appropriate label in the correct.pdfFungal reproductive cycle. Place the appropriate label in the correct.pdf
Fungal reproductive cycle. Place the appropriate label in the correct.pdf
 
Explain the concept of distributive justiceSolutiondistributiv.pdf
Explain the concept of distributive justiceSolutiondistributiv.pdfExplain the concept of distributive justiceSolutiondistributiv.pdf
Explain the concept of distributive justiceSolutiondistributiv.pdf
 
Fecal-oral infections are often a result of _____ droplet transmissi.pdf
Fecal-oral infections are often a result of _____  droplet transmissi.pdfFecal-oral infections are often a result of _____  droplet transmissi.pdf
Fecal-oral infections are often a result of _____ droplet transmissi.pdf
 
Dr. Z conducts a study examining the effect of socioeconomic status .pdf
Dr. Z conducts a study examining the effect of socioeconomic status .pdfDr. Z conducts a study examining the effect of socioeconomic status .pdf
Dr. Z conducts a study examining the effect of socioeconomic status .pdf
 
Double branded DNA viruses (select only one answer) all insert their.pdf
Double branded DNA viruses (select only one answer)  all insert their.pdfDouble branded DNA viruses (select only one answer)  all insert their.pdf
Double branded DNA viruses (select only one answer) all insert their.pdf
 
Discuss the mechanisms by which antibiotic resistance genes can be h.pdf
Discuss the mechanisms by which antibiotic resistance genes can be h.pdfDiscuss the mechanisms by which antibiotic resistance genes can be h.pdf
Discuss the mechanisms by which antibiotic resistance genes can be h.pdf
 
Develop two biologically relevant and researchable questions comparin.pdf
Develop two biologically relevant and researchable questions comparin.pdfDevelop two biologically relevant and researchable questions comparin.pdf
Develop two biologically relevant and researchable questions comparin.pdf
 
Describe two methods for communicating the material in an Informatio.pdf
Describe two methods for communicating the material in an Informatio.pdfDescribe two methods for communicating the material in an Informatio.pdf
Describe two methods for communicating the material in an Informatio.pdf
 
Describe the following structuresfunctions or cells Dermal, vascul.pdf
Describe the following structuresfunctions or cells  Dermal, vascul.pdfDescribe the following structuresfunctions or cells  Dermal, vascul.pdf
Describe the following structuresfunctions or cells Dermal, vascul.pdf
 
Describe the accounting and finance structure in an organization..pdf
Describe the accounting and finance structure in an organization..pdfDescribe the accounting and finance structure in an organization..pdf
Describe the accounting and finance structure in an organization..pdf
 
Consider an assembly of thousands of people, all screaming, yelling,.pdf
Consider an assembly of thousands of people, all screaming, yelling,.pdfConsider an assembly of thousands of people, all screaming, yelling,.pdf
Consider an assembly of thousands of people, all screaming, yelling,.pdf
 
Concrete and cementI) Give an example of non-calcium silicate cem.pdf
Concrete and cementI) Give an example of non-calcium silicate cem.pdfConcrete and cementI) Give an example of non-calcium silicate cem.pdf
Concrete and cementI) Give an example of non-calcium silicate cem.pdf
 
Compute the total interest and the monthly payments for an add-on i.pdf
Compute the total interest and the monthly payments for an add-on i.pdfCompute the total interest and the monthly payments for an add-on i.pdf
Compute the total interest and the monthly payments for an add-on i.pdf
 
Compare the views of Piaget and Vygotsky on school instruction in ab.pdf
Compare the views of Piaget and Vygotsky on school instruction in ab.pdfCompare the views of Piaget and Vygotsky on school instruction in ab.pdf
Compare the views of Piaget and Vygotsky on school instruction in ab.pdf
 
Can molds be unicellular If so, in what conditions and under what c.pdf
Can molds be unicellular If so, in what conditions and under what c.pdfCan molds be unicellular If so, in what conditions and under what c.pdf
Can molds be unicellular If so, in what conditions and under what c.pdf
 
Calculate the following cross exchange ratesThe dollar is trading.pdf
Calculate the following cross exchange ratesThe dollar is trading.pdfCalculate the following cross exchange ratesThe dollar is trading.pdf
Calculate the following cross exchange ratesThe dollar is trading.pdf
 
Bouchard Companys stock sells for $21 per share, its last dividen.pdf
Bouchard Companys stock sells for $21 per share, its last dividen.pdfBouchard Companys stock sells for $21 per share, its last dividen.pdf
Bouchard Companys stock sells for $21 per share, its last dividen.pdf
 
Answer the following question please.The answers I have is wrong, .pdf
Answer the following question please.The answers I have is wrong, .pdfAnswer the following question please.The answers I have is wrong, .pdf
Answer the following question please.The answers I have is wrong, .pdf
 
a) Research information about the U.S. Governments bailouts. Locat.pdf
a) Research information about the U.S. Governments bailouts. Locat.pdfa) Research information about the U.S. Governments bailouts. Locat.pdf
a) Research information about the U.S. Governments bailouts. Locat.pdf
 

Recently uploaded

DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
Kavitha Krishnan
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 

Recently uploaded (20)

DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 

Simple C++ Programming Multiple Files1030Prob2a.txt1030Prob2b..pdf

  • 1. Simple C++ Programming: Multiple Files 1030Prob2a.txt: 1030Prob2b.txt: Solution #include #include using namespace std; int main() { ofstream outputFile; outputFile.open ("sum.txt"); ifstream inputFile1; inputFile1.open("1030Prob2a.txt"); ifstream inputFile2; inputFile2.open("1030Prob2b.txt"); double n1, n2; if (inputFile1.is_open() && inputFile2.is_open()) { while (!inputFile1.eof() || !inputFile2.eof()) { n1 = 0; n2 =0; inputFile1 >> n1; inputFile2 >> n2; outputFile << (n1 + n2)<