Web Analytics Made Easy -
StatCounter C++ Sets.... - CodingForum

Announcement

Collapse
No announcement yet.

C++ Sets....

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • C++ Sets....

    I'm trying to implement a structure of sets and I'm having a very difficult time, thus far. If anyone can lend me some insight as to what I'm doing wrong and maybe point me in the right direction, I would appreciate it. Here is what I'm trying to do:
    #include<set>
    #include<vector>
    using namespace std;
    struct states{
    set<int> l;
    set<int> a;
    set<int> b;
    };
    int main(int argc,char *argv[]){
    states s;
    s.l.insert(1);
    s.a.insert(2);
    s.b.insert(3);
    return 0;
    }

    Obviously, there is more to the program, but this is the part I'm having problems with. I can't seem to get g++ to handle this and I can't see any errors in the logic of it. The errors say that l is not a member of struct states. It's the same for a and b, as well.

  • #2
    Nevermind, I got it working.

    Comment

    Working...
    X