您当前的位置: 首页 >  c++

C++ 动态取变量

发布时间:2021-12-26 16:11:53 ,浏览量:5

#include 
#include#includeusing namespace std;

int main()
{
    int a1 = 1;
    int a2 = 2;
    int a3 = 3;
    
    std::unordered_map tools;
    tools[1] = &a1;
    tools[2] = &a2;
    tools[3] = &a3;
    
    
    std::cout << "修改前" << endl;
    for(int i = 1; i <= 3; i++){
        printf("%d\n",*(tools[i]));
    }
    
    
    std::cout << "修改后" <            
关注
打赏
1688896170
查看更多评论

暂无认证

  • 5浏览

    0关注

    115984博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0454s