0

i have made a queue using STL. the queue contains strings only. how to check for a particular string if it present in queue or not?

Edited by deceptikon: Moved to C++

2
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by Ancient Dragon
0

actually i m using strcmp function for ccomparing which is giving type mismatch error.
so i did this : queue<char*> myqueue .
earlier it was: queue<string> myqueue

now the error has gone and code works fine but i didnot understand what does queue<char*> myqueue means?
what type value the queue have?

and sorry for the late reply.

0

You don't use strcmp with std::string, instead std::string has == operator that returns true if the two strings are equal, false otherwise. for example

std::string s = "Hello";
if( s == "HELLO" )
{

}

Edited by Ancient Dragon

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.