This is my problem

//now use outfile of cout to write to the file;

// use "\t" to seprarte fields

for (int k = 0; k<= m-1 ; k++

outfile << pa [k] << "\t" << qa [k] << endl;

}

I need help in writing a solution to the above problem with the info provided. Whatever help or suggestions would help me to understand and then I can complete the rest of the program. This is an array type problem and there is much more than what I submitted. Thank you.

Kim

Here is the entire problem which is an inventory: sorting and updating using arrays also the Indat File or input file. I need to write a code to run this program, everything else is done with no errors or warnings. I hope this is enough info to help solve this problem, if this is not enough, let me know. Thanks

#include <iostream.h>

#include <math.h>

#include <fstream.h>

const int arraySize = 100;

int pa[arraySize], qa[arraySize];

void loadarray(int &m);

void sortarray(int m);

void updatearray(int m);

void printarray(int m);

int reorder(int m);

void swap(int &r, int &s);

main()

{

int n,m;

n = 0;

loadarray(n);

cout << n+1 << " is the actual size of the array" << endl;

sortarray(n);

updatearray(n);

printarray(n);

m = reorder(n);

cout << "number low " << m << endl;

return 0;

}

void loadarray(int & m)

{

ifstream infile = "indat.txt";

infile >> pa[m] >> qa[m];

while (qa[m] >= 0)

{

m++;

infile >> pa[m] >> qa[m];

}

m--;

}

void sortarray(int m)

{

for (int k = m-1;k >= 0;k--)

for (int j = 0;j <= k;j++)

if (pa[j] > pa[j+1])

{

swap(pa[j],pa[j+1]);

swap(qa[j],qa[j+1]);

}

}

void updatearray(int m)

{

int part, quant;

cin >> part >> quant;

int s = 0;

while (part > pa[s] && s < m)

s++;

if (part == pa[s])

qa[s] += quant;

else

cout << "bad part number " << part << endl;

cin.get();

cin.get();

/*int c,p,q,k;

cout << "enter code, part number, quantity" << endl;

cin >> c >> p >> q;

while ((c==0) || (c==1))

{

k=0;

while (p > pa[k] && k < m)

++k;

//now update inventory if part number found;

//else bad part #

//now ready for more input

}*/

}

void printarray(int m)

{

ofstream outfile = "dataout.txt";

// now use outfile instead of cout to write to the file;

// use "\t" to separate fields

for (int r = 0;r <= m;r++)

cout << pa[r]<< "\t" << qa[r] << endl;

}

int reorder(int m)

{

int r;

r=0;

cout << "reorder list" << endl;

// code the for loop to find items for which quantity is less than five

// increment the return value r every time an item is put on the ;ist

r += 10;

return r;

}

void swap(int &r, int &s)

{

int temp = r;

r = s;

s = temp;

}

Indat File

7777 45

6666 52

8888 12 9999 81 2222 7 4444 41 5555 33 1111 22 3333 97 2121 45 3131 125 1121 15 4141 61 8141 97 8181 14 9119 12 9191 117 9889 42 6889 73 1234 15 2345 110 3456 83 4567 15 5678 7 6789 55 7890 88 8901 32 9000 -10