Compile Error in Maps and Vectors

I was writing this program

I think it is fully fine but Atom is showing error when I try to run it. Can someone tell me where I have made a mistake ?

1 Like

As the vector consists of pairs, by printing family[i], you want to print pairs, which isn’t possible, you have to either do cout << family[i].first or cout << family[i].second


use cout << family[i].first << " " << family[i].second; while you run the loop :slight_smile:

Oh ! Thanks a lot guys !!! :slight_smile:

1 Like

try operator overloading this same statement you are writing will work.
“operator overloading” is definitely not a cp part, its OOPS part.