lonequal.cpp

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C++ 代码 · 共 30 行

CPP
30
字号
#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 or equals to" :
                                    "is shorter than" )
         << " string \"" << s2 << "\"" << endl;
    cout << "String \"" << s1 << "\" "
         << ( operator >=( s1, s3 ) ? "is longer than or equals to" :
                                    "is shorter than" )
         << " string \"" << s3 << "\"" << endl;
    cout << "String \"" << s1 << "\" "
         << ( operator >=( s1, pch1 ) ? "is longer than or equals to" :
                                      "is shorter than" )
         << " string \"" << pch1 << "\"" << endl;
    cout << "String \"" << pch2 << "\" "
         << ( operator >=( pch2, s1 ) ? "is longer than or equals to" :
                                      "is shorter than" )
         << " string \"" << s1 << "\"" << endl;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?