``````/*My problem is on line with outdata1<<A3[p]<<endl; its says no operator found, help would be much appreciated*/

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

struct Data {
string salesperson;
string style;
double price;
int quantity;
};
int x;
int y;
int i=0;

struct Data A1[100], A2[100], A3[100];
int size=x+y;
void Merge(Data A1[], Data A2[], Data A3[])
{

A3[100];

for(int i=0; i<x; i++)
{
A3[i].salesperson=A1[i].salesperson;
A3[i].style=A1[i].style;
A3[i].price=A1[i].price;
A3[i].quantity=A1[i].quantity;
}
for(int j=0; j<y; j++)
{
A3[j+x].salesperson=A2[j].salesperson;
A3[j+x].style=A2[j].style;
A3[j+x].price=A2[j].price;
A3[j+x].quantity=A2[j].quantity;
}
Data temp;
for(int k=0; k<size; k++)
{
for(int n=0; n<((size*(size-1))/2); n++)
{
if(A3[n].salesperson>A3[n+1].salesperson)
{   temp=A3[n];
A3[n]=A3[n+1];
A3[n+1]=temp;
}
}
}
}

void CBR_Name(Data A3[]){
ofstream outdata1;
outdata1.open("CBR_Name.txt");
int count[7];
for(int t=0; t<7; t++){
count[t]=0;}
for(int p=0; p<size; p++){
outdata1<<A3[p]<<endl;//HERE IS THE MISTAKE
if(A3[p+1].salesperson==A3[p].salesperson){
if(A3[p].style=="Elegant"){
count[0]++;}
else if(A3[p].style=="Exquisite"){
count[1]++;}
else if(A3[p].style=="Excalibur"){
count[2]++;}
else if(A3[p].style=="Excelsior"){
count[3]++;}
else if(A3[p].style=="Imagine"){
count[4]++;}
else if(A3[p].style=="Impression"){
count[5]++;}
else if(A3[p].style=="Inspire"){
count[6]++;}
}
else{
int higheststyle=0;
for(int h=0; h<7; h++){
if(count[h]>higheststyle){
higheststyle=count[h];
outdata1<<A3[p].salesperson<<"Highest Style is "<<higheststyle<<endl;
}
}
}
}
outdata1.close();
}
int main(){

ifstream indata1;
indata1.open("FPData1.txt");
A1[100];
int x=0;
while(!indata1.eof())
{
indata1>>A1[x].salesperson>>A1[x].style>>A1[x].price>>A1[x].quantity;
x++;
}

ifstream indata2;
indata2.open("FPData2.txt");
A2[100];
int y=0;
while(!indata2.eof())
{
indata2>>A2[y].salesperson>>A2[y].style>>A2[y].price>>A2[y].quantity;
y++;
}

Merge(A1, A2, A3);
CBR_Name(A3);
indata1.close();
indata2.close();
return 0;
}
``````

Please use code tags when you post code.

You cannot re-use the word 'struct' here.

``struct Data A1[100], A2[100], A3[100];``

It needs to be:

``Data A1[100], A2[100], A3[100];``

Also, please only post relevant code - that is, the shortest compilable code that produces the error you are talking about.

Good luck,

David

Thanks I fixed what you told me, but my error is on the code down below. I put a comment next to error.

``````void CBR_Name(Data A3[]){
ofstream outdata1;
outdata1.open("CBR_Name.txt");
int count[7];
for(int t=0; t<7; t++){
count[t]=0;}
for(int p=0; p<size; p++){
outdata1<<A3[p]<<endl;//HERE IS THE MISTAKE
if(A3[p+1].salesperson==A3[p].salesperson){
if(A3[p].style=="Elegant"){
count[0]++;}
else if(A3[p].style=="Exquisite"){
count[1]++;}
else if(A3[p].style=="Excalibur"){
count[2]++;}
else if(A3[p].style=="Excelsior"){
count[3]++;}
else if(A3[p].style=="Imagine"){
count[4]++;}
else if(A3[p].style=="Impression"){
count[5]++;}
else if(A3[p].style=="Inspire"){
count[6]++;}
}
else{
int higheststyle=0;
for(int h=0; h<7; h++){
if(count[h]>higheststyle){
higheststyle=count[h];
outdata1<<A3[p].salesperson<<"Highest Style is "<<higheststyle<<endl;``````

That did it thanks.