hello, there...

how would you send a signal to end this loop

string s;
int counter;
while(cin >> s){
   counter++;
}

thanks...

Recommended Answers

All 2 Replies

determins what you are looking for.

since you have String s you can say if s == what i am looking for

break;

that will terminate the loop and continue.

so

while(cin >> s)
{
if (s == "what i want")
    break;
count++;
}

i was testing something...lol..thanks dude...reputation point for you! :)

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.