zoukankan      html  css  js  c++  java
  • The quick brown fox jumps over the lazy dog.

    http://v.youku.com/v_show/id_XMTA4ODEwNjM2.html

    The quick brown fox jumps over the lazy dog.
    一只敏捷的棕色狐狸跳到了一只懒狗身上。
    据说该句是包含所有26个字母的最短的句子。

    1句9词26字-----------微软MSDN中常用来做各种字符串比较操作的例子。

    MSDN2001

    Example
    /* STRCMP.C */

    #include <string.h>
    #include <stdio.h>

    char string1[] = "The quick brown dog jumps over the lazy fox";
    char string2[] = "The QUICK brown dog jumps over the lazy fox";

    void main( void )
    {
        char tmp[20];
        int result;
        /* Case sensitive */
        printf( "Compare strings:\n\t%s\n\t%s\n\n", string1, string2 );
        result = strcmp( string1, string2 );
        if( result > 0 )
            strcpy( tmp, "greater than" );
        else if( result < 0 )
            strcpy( tmp, "less than" );
        else
            strcpy( tmp, "equal to" );
        printf( "\tstrcmp:   String 1 is %s string 2\n", tmp );
        /* Case insensitive */
        result = _stricmp( string1, string2 );
        if( result > 0 )
            strcpy( tmp, "greater than" );
        else if( result < 0 )
            strcpy( tmp, "less than" );
        else
            strcpy( tmp, "equal to" );
        printf( "\t_stricmp:  String 1 is %s string 2\n", tmp );
    }
    Output
    Compare strings:
    The quick brown dog jumps over the lazy fox
    The QUICK brown dog jumps over the lazy fox
    strcmp:   String 1 is greater than string 2
    _stricmp:  String 1 is equal to string 2

    //demo.cpp

    #include<iostream>
    using namespace std;

    int main()
    {
                    //01234567890123456789012345678901234567890123==45
        char slang[]="The quick brown fox jumps over the lazy dog.";

        cout<<"sizeof(slang)=="<<sizeof(slang)<<endl;

        cin.get();

        return 0;
    }

  • 相关阅读:
    初识数据库
    局域网和广域网
    面试题汇总
    SSO单点登录解决方案
    接口加密问题
    幂等性问题
    消息队列的消费失败、重复消费问题
    Redis集群搭建
    HashCode详解
    HashMap的底层原理
  • 原文地址:https://www.cnblogs.com/shanzy/p/2668144.html
Copyright © 2011-2022 走看看