consider this for

int i.j;
    for (i=0;i<=5;i++){
    for (j=i+1;j<=5;j++){cout<<"\n"<<i<<"\t"<<j<<"\n";
    }
}

now suppose we have

list<string>::iterator l,m;

the corresponding thing

for (l=0;l<=5;l++){
    for (k=l+1;k<=5;k++){cout<<"\n"<<i<<"\t"<<j<<"\n";
    }
}

won't work because "l+1" is meaningless here.

How do I solve this problem?

>How do I solve this problem?
Think squiggly:

for (l=0;l<=5;l++){
    for (k=l,++k;k<=5;k++){cout<<"\n"<<i<<"\t"<<j<<"\n";
    }
}

:)

>How do I solve this problem?
Think squiggly:

for (l=0;l<=5;l++){
    for (k=l,++k;k<=5;k++){cout<<"\n"<<i<<"\t"<<j<<"\n";
    }
}

:)

guess I made a joke of myself.

>guess I made a joke of myself.
There's no such thing as a stupid question, so don't worry about it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.