I want to get the maximun number of a variable which belong to a struct,so I have a vector composed by objects of that kind of struct,I want to analyse the variable order in all the objects through the vector composed by struct object and show the whole information of the one has the biggest number order...
I'm doing this, but think It doesnt make any sense..
1 2 3 4
int a = WorkShop.size();
cout << "Board Information of Maximun Order"<<"\n";
cout<<"Maximum Order:"<<"\n"<<*max_element(order.WorkShop,order.WorkShop+a,WorkShop);
The compiler says, that 'order' was not declared in the scope...
This is the example of Cplusplus
1 2 3 4 5 6 7 8
struct myclass {
booloperator() (int i,int j) { return i<j; }
} myobj;
// using object myobj as comp:
std::cout << "The smallest element is " << *std::min_element(myints,myints+7,myobj) << '\n';
std::cout << "The largest element is " << *std::max_element(myints,myints+7,myobj) <<
I'm using the function where It takes an object.
In the third parameter I have to type the object in my case It's WorkShop which is an object of my Bench struct...and In the first and second parameter I have to put the first order belonging to the first struct and the last order belonging to the last struct.....I think the trouble is that WorkShop y a vector with this shape....Vector<Bench> WorkShop....
I dont know how to address this...could you explain me, please??I know there is somethin that I'm missing...