c++ 如何根据系统定义全局常量字符串?

类似在程序开头定义
if(iswin7)
{
string str="112233445566";
}
if(iswin10)
{
string str="665544332211";
}
然后可以在函数中使用
vold abc()
{
cout<<str<<endl;
}


// 获取Windows准确的版本号,不依赖于 manifest 文件,也不受兼容性的影响。
#include <string.h>
#include <stdio.h>
#include <windows.h>
#include <lm.h>
#include <string>
#include <iostream>
#pragma comment(lib, "netapi32.lib")
char winver[16];
std::string str=std::string("000000000000");//默认值
int main() {
    WKSTA_INFO_100 *wkstaInfo = NULL;
    NET_API_STATUS netStatus = NetWkstaGetInfo(NULL, 100, (LPBYTE *)&wkstaInfo);
    if (netStatus == NERR_Success) {
        DWORD dwMajVer = wkstaInfo->wki100_ver_major;
        DWORD dwMinVer = wkstaInfo->wki100_ver_minor;
//      DWORD dwVersion = (DWORD)MAKELONG(dwMinVer, dwMajVer);
        netStatus = NetApiBufferFree(wkstaInfo);
        sprintf(winver,"%d.%d",dwMajVer,dwMinVer);
    } else {
        sprintf(winver,"unknown");
    }
    if (0==strcmp("10.0",winver)) str=std::string("665544332211");
    if (0==strcmp( "7.0",winver)) str=std::string("112233445566");
    std::cout<<"winver:"<<winver<<std::endl;
    std::cout<<"str:"<<str<<std::endl;
    return 0;
}
//winver:10.0
//str:665544332211
//