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.

Recommended Answers

All 5 Replies

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.

So? What have you done for your homework?
Remember it is YOUR homework.

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();

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.