直接上代码吧:

boolean CompareVersion(string softVersion1, string softVersion2)
{
if (softVersion1.compare(softVersion2) >= 0)
{
return true;
}
return false;
}
void main(void)
{
    string appVersion = "1.4.2";
    string softVersion = "1.5.0";
    if (CompareVersion(appVersion, softVersion))
    {
        printf("appVersion 版本大于softVersion 版本");
    }
    else
    {
        printf("appVersion 版本小于softVersion 版本");
    }
}

参考:http://blog.csdn.net/atvhghnhtb/article/details/24248469

posted on 2017-10-24 15:04  瓦楞球  阅读(322)  评论(0编辑  收藏  举报