I have code that reads and writes sstrings to file but I am having trouble meeting these
requirements. My program writes the string names into the file and not the number of bags. I
think a for loop is needed to keep track of how many times their name is written and then check
their on board status but I'm not sure. This is the code I have
#include
#include
#include
using namespace std;
int openOutputFile();
int openInputFile();
void readInputRecord(ifstream& inpt);
void writeOutputRecord(ofstream& opt);
int count_b = 0;
int count_p = 0;
string PassengerArray[100];
string BaggageArray[300];
int main()
{
openInputFile();
openOutputFile();
system("pause");
}
void readInputRecord(ifstream& inpt)
{
string line;
int i = 0;
//read passanger from file
while (getline(inpt, line))
{
PassengerArray[i] = line;
i++;
}
cout << "Passanger Array " << endl;
for (int k = 0; k
Solution
while (getline(inpt, line) && line != "")
{
BaggageArray[i] = line;
i++;
}
count_b = i;
cout << "Baggage Array" << endl;
for (int k = 0; k

More Related Content

PDF
Mitosis promoting factor is associated with cyclin b. Which class of .pdf
PDF
LTE uses an all IP data network, with voice calls reduced to a multim.pdf
PDF
I Need Serious Help with this assignment. Plenty Points to be earned.pdf
PDF
Genes A and B are on different chromosomes. A dihybrid with the geno.pdf
PDF
Do the following program in C++- Create a item class... with and i.pdf
PDF
Explain the process of RNAi and how it contributes to differential .pdf
PDF
Consider the following scenario A population of moderately pigmented.pdf
PDF
Consider the simple analog signal defined by x(t) = sin(2700t) shown.pdf
Mitosis promoting factor is associated with cyclin b. Which class of .pdf
LTE uses an all IP data network, with voice calls reduced to a multim.pdf
I Need Serious Help with this assignment. Plenty Points to be earned.pdf
Genes A and B are on different chromosomes. A dihybrid with the geno.pdf
Do the following program in C++- Create a item class... with and i.pdf
Explain the process of RNAi and how it contributes to differential .pdf
Consider the following scenario A population of moderately pigmented.pdf
Consider the simple analog signal defined by x(t) = sin(2700t) shown.pdf

More from ahntagencies (20)

PDF
Cell adhesion, both cell-cell and cell-ECM, can influence whether a c.pdf
PDF
A(n) is a method of interacting with a PC by manipulating visual ele.pdf
PDF
You are about to perform a clean install of Windows 7 on a brandnew .pdf
PDF
Write the equation of a 4th degree polynomial function with the follo.pdf
PDF
Write a program which repeatedly calls a function named replaceIt() a.pdf
PDF
Which, of the below choices of inference rules, is used to show that.pdf
PDF
Which of the following protocols is used for router multicastingA.pdf
PDF
Which of the following isare not produced by homosporous plants [se.pdf
PDF
When Gregor Mendel was developing his ideas of inheritance of cha.pdf
PDF
what kind of short tandem repeats DNA markers can be used for tracin.pdf
PDF
What is the job of a layout managerTo render user interface compo.pdf
PDF
Using the Bernoulli method, solve the differential equation t^2 dyd.pdf
PDF
What are the implications of Darwins ideas for the traditional .pdf
PDF
What are the factors that underlie the observation that EBV infectio.pdf
PDF
What is an advantage of the hanging drop method verses simple sta.pdf
PDF
What are key factors to consider when selecting a flow sensorSo.pdf
PDF
The process of DNA replication creates a particular problem for repl.pdf
PDF
The lifetime T of a certain device (in 1000 hour units) has the expo.pdf
PDF
The Federal Reserve controls the nations money supply by using var.pdf
PDF
Suppose S is a set people, and R is the following relation on S aRb.pdf
Cell adhesion, both cell-cell and cell-ECM, can influence whether a c.pdf
A(n) is a method of interacting with a PC by manipulating visual ele.pdf
You are about to perform a clean install of Windows 7 on a brandnew .pdf
Write the equation of a 4th degree polynomial function with the follo.pdf
Write a program which repeatedly calls a function named replaceIt() a.pdf
Which, of the below choices of inference rules, is used to show that.pdf
Which of the following protocols is used for router multicastingA.pdf
Which of the following isare not produced by homosporous plants [se.pdf
When Gregor Mendel was developing his ideas of inheritance of cha.pdf
what kind of short tandem repeats DNA markers can be used for tracin.pdf
What is the job of a layout managerTo render user interface compo.pdf
Using the Bernoulli method, solve the differential equation t^2 dyd.pdf
What are the implications of Darwins ideas for the traditional .pdf
What are the factors that underlie the observation that EBV infectio.pdf
What is an advantage of the hanging drop method verses simple sta.pdf
What are key factors to consider when selecting a flow sensorSo.pdf
The process of DNA replication creates a particular problem for repl.pdf
The lifetime T of a certain device (in 1000 hour units) has the expo.pdf
The Federal Reserve controls the nations money supply by using var.pdf
Suppose S is a set people, and R is the following relation on S aRb.pdf

Recently uploaded (20)

PDF
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PDF
Environmental Education MCQ BD2EE - Share Source.pdf
PPTX
What’s under the hood: Parsing standardized learning content for AI
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 2).pdf
PPTX
Introduction to pro and eukaryotes and differences.pptx
PDF
Mucosal Drug Delivery system_NDDS_BPHARMACY__SEM VII_PCI.pdf
PDF
Complications of Minimal Access-Surgery.pdf
PDF
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
PDF
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
PPTX
Module on health assessment of CHN. pptx
PDF
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
PDF
Hazard Identification & Risk Assessment .pdf
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
Uderstanding digital marketing and marketing stratergie for engaging the digi...
PDF
Journal of Dental Science - UDMY (2021).pdf
PDF
International_Financial_Reporting_Standa.pdf
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
PPTX
B.Sc. DS Unit 2 Software Engineering.pptx
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
A powerpoint presentation on the Revised K-10 Science Shaping Paper
Environmental Education MCQ BD2EE - Share Source.pdf
What’s under the hood: Parsing standardized learning content for AI
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 2).pdf
Introduction to pro and eukaryotes and differences.pptx
Mucosal Drug Delivery system_NDDS_BPHARMACY__SEM VII_PCI.pdf
Complications of Minimal Access-Surgery.pdf
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
Module on health assessment of CHN. pptx
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
Hazard Identification & Risk Assessment .pdf
What if we spent less time fighting change, and more time building what’s rig...
Uderstanding digital marketing and marketing stratergie for engaging the digi...
Journal of Dental Science - UDMY (2021).pdf
International_Financial_Reporting_Standa.pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
B.Sc. DS Unit 2 Software Engineering.pptx

I have code that reads and writes sstrings to file but I am having t.pdf

  • 1. I have code that reads and writes sstrings to file but I am having trouble meeting these requirements. My program writes the string names into the file and not the number of bags. I think a for loop is needed to keep track of how many times their name is written and then check their on board status but I'm not sure. This is the code I have #include #include #include using namespace std; int openOutputFile(); int openInputFile(); void readInputRecord(ifstream& inpt); void writeOutputRecord(ofstream& opt); int count_b = 0; int count_p = 0; string PassengerArray[100]; string BaggageArray[300]; int main() { openInputFile(); openOutputFile(); system("pause"); } void readInputRecord(ifstream& inpt) { string line; int i = 0; //read passanger from file while (getline(inpt, line)) { PassengerArray[i] = line; i++; } cout << "Passanger Array " << endl; for (int k = 0; k
  • 2. Solution while (getline(inpt, line) && line != "") { BaggageArray[i] = line; i++; } count_b = i; cout << "Baggage Array" << endl; for (int k = 0; k