C++ std operator>=C++ std Operator>= is a non-member overloaded function of set in C++. This function is used to check whether the first set is greater than or equal to other or not. Note: Operator >= sequentially compares the element of set and comparison will stop at first mismatch.SyntaxParameterlhs: First set object. rhs: Second set object. Return valueIt returns true if the left side of the set container object is greater than or equal to the right side of the set container object otherwise, false. ComplexityComplexity will be constant, if the size of lhs and rhs is different. Otherwise, up to linear in the size of lhs and rhs. Iterator validityNo changes. Data RacesContainers, lhs and rhs are accessed. Concurrently accessing the elements of unmodified set is always safe. Exception SafetyThis function does not throw an exception. Example 1Let's see the simple example to check whether the first set is greater than or equal to or not: Output: Set m1 is greater than or equal to m2. Set m1 is not greater than or equal to m2. In the above example, there are two sets m1 and m2. m1 and m2 contain one element. When we compare both sets then it will display the message "set m1 is greater than or equal to m2" and after adding one more element to m2, it will display the message "set m1 is not greater than or equal to m2". Example 2Let's see a simple example: Output: The set m1 is less than the set m2. Set m1 is greater than or equal to set m3. Set m1 is greater than or equal to set m4. Example 3Let's see a simple example: Output: 1 0 In the above example if m1 is greater than or equal to m2 then it will return 1 otherwise 0. Example 4Output: 1). ---------Login---------- Enter password: xyz@123 Password you have entered: xyz@123 Password stored in the system : xyz@123 Welcome to your Page... 2). ---------Login---------- Enter password: abc@122 Password you have entered: abc@122 Password stored in the system : xyz@123 Incorrect Password... In the above example, there are two sets m1 and m2. m1 contains stored password and second set m2 stores user's entered password. It checks whether the m1 is greater than or equal to m2 or not. If password of m1 is greater than or equal to m2 then login is successful otherwise, login fails. Next TopicSet swap() Function |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India