关于字母-'0'

#include<iostream>
#include<cstring>
using namespace std;
int main()
{   int i;
    int bb[67];
    int cc[67];
    int dd[67];
    int ee[67];
    memset(cc,0,sizeof(cc));
    memset(bb,0,sizeof(bb)); 
    memset(dd,0,sizeof(dd));
    memset(ee,0,sizeof(ee));
    char array[250]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
    char array_1[250]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
    int len=strlen(array);
    for(i=0;i<len;i++)
    {
        bb[i]=array[i]-'0';
        cc[i]=array_1[i]-'0';
        dd[i]=array[i];
        ee[i]=array_1[i];
        cout<<bb[i]<<"   "<<cc[i]<<"   "<<dd[i]<<"   "<<ee[i]<<endl;
        
    }
    return 0;
    
}

int a='A'直接输出的是A的ASCII值,而int a='A'-'0'不是,比A的ASCII值小48

A到Z 的数值范围是17-40

a到z的数值范围是49-72  (中间差9)

A到Z的ACSII值范围是65-88

a到z的ASCII范围是97-120  (中间差9)

posted @ 2014-04-02 16:21  盒子先生★  阅读(455)  评论(0编辑  收藏  举报