This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/cplbexam/string/friend/long.cpp

26 lines
917 B
C++
Raw Normal View History

#include <string.hpp>
void main( void ) {
String s1 ("Open Watcom C++");
String s2 ("Open Watcom C++ compiler");
String s3 ("Open Watcom C");
char *pch1, *pch2;
pch1 = "Open Watcom C++ ";
pch2 = "Open Watcom C";
cout << "String \"" << s1 << "\" "
<< ( operator >( s1, s2 ) ? "is longer than" : "is shorter than" )
<< " string \"" << s2 << "\"" << endl;
cout << "String \"" << s1 << "\" "
<< ( operator >( s1, s3 ) ? "is longer than" : "is shorter than" )
<< " string \"" << s3 << "\"" << endl;
cout << "String \"" << s1 << "\" "
<< ( operator >( s1, pch1 ) ? "is longer than" : "is shorter than" )
<< " string \"" << pch1 << "\"" << endl;
cout << "String \"" << pch2 << "\" "
<< ( operator >( pch2, s1 ) ? "is longer than" : "is shorter than" )
<< " string \"" << s1 << "\"" << endl;
}