#include <iostream>
#include <fstream>
#include <iomanip>
usingnamespace std;
struct record{
int id;
int cost;
double price;
char descr[37];
};
struct mliat{
int id;
int cost;
};
void lox(mliat m[],int count){
int min;
for (int j = 0; j < count-1; j++) {
min=j;
for (int i = j+1; i < count; i++) {
if (m[i]<m[min]) {
min = i;
}
}
}
}
int sortByCost(constchar *inFile, int *array,int count)
{
ifstream file;
file.open(inFile, ios::binary);
record data;
mliat cyka;
mliat *ptr;
ptr=new mliat[count];
char *records,*cost;
int length,error=0,i;
if (!file)
{
cerr << "Error opening file. Program aborting." << endl;
return(-2);
}
if ( count >0){
for(i=0;i<=count;i++)
file.read(reinterpret_cast<char *>(&data), sizeof(data));
ptr[i].id=data.id;
ptr[i].cost=data.cost;
}
lox(&ptr[count],count);
cout<<cyka.id<<endl;
cout<<cyka.cost;
file.clear();
file.seekg(sizeof(data) * count, ios::beg);
file.close();
return 0;
}
the compiler gives out the error
no match for 'operator<' in '*((+(((unsigned int)i) * 8u)) + m) <*((+(((unsigned int)min) * 8u)) + m)' for the line f (m[i]<m[min]) in the function lox
for some reason, the code is really unfinished by the way, i just need to figure out wats causing this error