operator!=

C++ Library  
 
 

Header

<stack>
template<class T, class Cont>
bool operator!=(const stack<T, Cont>&s1, const stack<T, Cont>&s2) ;

The opposite of equality operation. The function returns !(s1 == s2).


Sample

#include <iostream>
#include <stack>

int main()
{
	std::stack<int> s1, s2, s3, s4 ;
	int i ;

	for (i = 0; i < 10; i++)
	{
		s1.push(i) ;
		s2.push(i*i) ;
		s3.push(i*i*i) ;
		s4.push(i) ;
	}

	if (s1 == s4)
		std::cout << "s1 == s4" << std::endl ;
	
	if (s2 != s3)
		std::cout << "s2 != s3" << std::endl ;

	if(s2 < s3)
		std::cout << "s2 < s3" << std::endl ;

	if(s3 > s2)
		std::cout << "s3 > s2" << std::endl ;

	s4.push(29) ;

	if (s1 <= s4)
		std::cout << "after s4.push(29), s1 <= s4" << std::endl ;

	if (s3 >= s2)
		std::cout << "s3 >= s2" << std::endl ;


	return 0 ;
}

Program Output

s1 == s4
s2 != s3
s2 < s3
s3 > s2
after s4.push(29), s1 <= s4
s3 >= s2

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.