how to remove a tuple of tupleset with conditions

  Kiến thức lập trình

I habe the code like this:

tuple Variableset{
  int rooms;
  int days;
  int slots;
  int instructors;
  int groups;
  int courses;
}

{Variableset} A = ...;

tuple Solution{
  int days;
  int slots;
  int instructors;
}

{Solution} B = ...;

{Variableset} C;
execute {
    for (var s in B)
      for (var item in A){
        if (item.days == s.days && item.slots == s.slots
         && item.instructors == s.instructors) {
           C == A.remove(item);           
           
         };
      };
        
    };
};




I’m trying to create a new tuple set C by removing the tuples in A whose elements of B are the same as those of A. I know my code isn’t quite right, I’d love some help to fix it. Thanks in advance!

LEAVE A COMMENT