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;
    }

  • 相关阅读:
    Visual Studio 20**自动添加头部注释信息
    开发使用混合式Winform模块
    java 下拉框级联及相关(转)
    Redhat关闭SELinux和防火墙的办法(转)
    icmp的报文,Destination Host Unreachable
    负载均衡-lvs
    深入浅出交换类排序算法(转)
    单源最短路径(dijkstra算法)php实现
    垂死挣扎还是涅槃重生 -- Delphi XE5 公布会归来感想
    oracle递归函数
  • 原文地址:https://www.cnblogs.com/shanzy/p/2668144.html
Copyright © 2011-2022 走看看