C++ multimap operator>=C++ operator>= is a non-member overloaded function of multimap in C++. This function is used to check whether the first multimap is greater than or equal to other or not. Note: Operator >= sequentially compares the element of multimap and comparison will stop at first mismatch.SyntaxParameterlhs: First multimap object. rhs: Second multimap object. Return valueIt returns true if the left side of the multimap container object is greater than or equal to the right side of the multimap container object otherwise false. ComplexityComplexity will be constant, if the size of lhs and rhs is different. Otherwise, up to linear in the size (equality comparisons). Iterator validityNo changes. Data RacesContainers, lhs and rhs are accessed. Exception SafetyThis function does not throw an exception. Example 1Let's see the simple example to check whether the first multimap is greater than or equal to or not: Output: Multimap m1 is greater than or equal to m2. Multimap m1 is not greater than or equal to m2. In the above example, there are two multimaps m1 and m2. m1 and m2 contains one element. When we compare both multimaps then it will display the message "multimap m1 is greater than or equal to m2" and after adding one more element to m2, it will display the message "multimap m1 is not greater than or equal to m2". Example 2Let's see a simple example: Output: The multimap m1 is less than the multimap m2. Multimap m1 is greater than or equal to multimap m3. Multimap m1 is greater than or equal to multimap 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 the ID and password: 1020 xyz ID and password you have entered: 1020 xyz ID and Password stored in the system: 2040 [email protected] Incorrect ID or Password... 2). ---------Login---------- Enter the ID and password: 2040 [email protected] ID and password you have entered: 2040 [email protected] ID and Password stored in the system: 2040 [email protected] Welcome to your Page... In the above example, there are two multimaps m1 and m2. m1 contains stored ID and password and second multimap m2 stores user's entered ID and password. It checks whether the m1 is greater than or equal to m2 or not. If ID and password of m1 is greater than or equal to m2 then login is successful otherwise login fails.
Next TopicC++ Multimap
|