First off, in your for loop you set i to 1, that means that each time it will become 1, add one at end to make 2, but become 1 again at the beginning, resulting i an infinite loop.
When using a for loop you should try not to do any assignments to i, or whatever iterator is called. The for loop takes care of this.
If you incrment i yourself at the end, then the for loop will increment it again, meaning every loop increases it by 2 instead of just 1.
Second, in order to compare your global variable to your class instance, you can only use the == or != operators. >, <, etc operators would have to be written that handle each data member and set up rules.
Your class has an M1, M2, and M3, if you compared a CPart to another CPart with the > you'd have to make an > operator function to define whether all the parts have to be > in order for the entire thing to come up true.
I compared each side of the global triangle and the curent indexed triangle. Only if global.side1<indexed[#]side1 &&(and) side2 &&(and) side3 are all true then it does whatever.
using namespace std;
triangle yourGlobalTriangle;//this is the global you spoke of
yourGlobalTriangle.side1=5;//it has 3 parts, intialize each part
triangle bunchOfTriangles;//an array of 5 triangles, each triangle has 3 sides, so you have a total of 15 numbers stored here
for(int index=0;index<5;index++)//once done with all five triangles then break
cout<<"Please enter the length of each side for triangle number "<<(index+1)<<", hit enter after each length:\n";
cin>>bunchOfTriangles[index].side1;//use the . operator to access the data member
cin>>bunchOfTriangles[index].side2;//use the . operator to access the data member
cin>>bunchOfTriangles[index].side3;//use the . operator to access the data member
if( (bunchOfTriangles[index].side1<=yourGlobalTriangle.side1) && (bunchOfTriangles[index].side2<=yourGlobalTriangle.side2) && (bunchOfTriangles[index].side3<=yourGlobalTriangle.side3) )
cout<<"All sides in triangle number "<<index+1<<", are less than corresponding sides of yourGlobalTriangle\n";
You can't compare a triangle to a triangle, or a Cpart to a Cpart using < because they are user defined classes.
In order to do that you'd have to write your own < operator for the class.
That way you the programmer get to setup the rules. You may decide that only if the sum of the parts are less than the sum of the parts of the other one then it comes up true.
Or only one of the parts has to be less than, out of all of them. You would do it just like I did except you would use ||(or) instead of the &&(and) operator.
However, before you try to write an operator function try writing regular member functions. Once you have mastered them then you can move on to operator functions.