Using Data1.txt and Data2.txt, create two control break reports.

The first should break on name and report the highest frequency style or styles. Send the report to result1.txt. Include appropriate headers.

The second should break on style and report the total quantity ordered for that style. Send the report to result2.txt. Include appropriate headers.

Use functions called Merge, Sort_Style, CBR_Name, and CBR_Style to simplify main. Use structs as needed.

Also, you must use arrays of size 100 to input your data into and to store your merged data.

We won't write your code for you. It's your homework, not ours. Show us some of your code and we can help you if you have problems. But don't think that we will do your hard work. These tasks are designed for you to learn. You won't learn anything if we give you the code.

Sorry guys, got sidetracked working on it. This is what i have so far for the loading the first two arrays and merging them into a third array.

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

struct salesTran{
    string name, style;
    double price;
    double quantity;
};
void merge (salesTran FPData1 [100],salesTran FPData2 [100],salesTran FPData3 [100]){
            for (int k=0; k<100; k++){
                int i=0;
                int j=0;
                if (FPData1[i].name<=FPData2[j].name){
                FPData3[k]=FPData1[i];
                i++;}
                else{ 
                    FPData3[k]=FPData2[j];
                j++;}
    }
}
salesTran FPData1[100], FPData2[100], FPData3[100];
int main(){
    ifstream indata1, indata2;
    ofstream outdata1, outdata2;
    indata1.open("FPData1.txt");
    indata2.open("FPData2.txt");
    outdata1.open("CBR1.txt");
    outdata2.open ("CBR2.txt");

    for (int i=0; i<100; i++){
        indata1>>FPData1[i].name;
        indata1>>FPData1[i].style;
        indata1>>FPData1[i].price;
        indata1>>FPData1[i].quantity;
    }
    for (int j=0; j<100; j++){
        indata2>>FPData2[j].name;
        indata2>>FPData2[j].style;
        indata2>>FPData2[j].price;
        indata2>>FPData2[j].quantity;
    }
    void merge();

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Please use code tags (push the code button before you paste the code). What problem are you currently having?

Haven't worked alot with functions or arrays and am trying to figure out if my third array in the merge function is reading my first two arrays and loading right.

This question has already been answered. Start a new discussion instead.