Simplezjz
SimpleMLXG
采纳率67.5%
2020-03-07 20:27 阅读 233

C++程序改错求 大佬帮忙

图片说明

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • 已采纳
    weixin_43891765 格戮 2020-03-07 21:34

    是这个意思吗?

    #include<stdio.h>
    struct ST{
        int data;
    };
    struct InnerST{
        int iData;
    };
    struct NestST{
        struct InnerST a;
        int data;
    };
    int main(){
        struct ST st1={15};
        struct NestST st3={25,35};
        struct InnerST st4={45};
    
        printf("st1.data=%d\n",st1.data);
        printf("st3.iData=%d,st3.data=%d\n",st3.a.iData,st3.data);
        printf("st4.iData=%d\n",st4.iData);
    
        return 0;
    }
    
    点赞 评论 复制链接分享
  • kukeqq qq284663407 2020-03-07 21:47
    #include <stdio.h>
    
    struct ST {
        int data;
        //...
    };
    
    struct InnerST {
        int iData;
    };
    
    struct NestST {
        struct InnerST iST;
        int data;
        //...
    };
    
    int main() {
        struct ST st1 = { 15 };
        struct NestST st3 = {
            {
                25,
            },
            35,
        };
        struct InnerST st4 = { 45 };
    
        printf("st1.data=%d\n", st1.data);
        printf("st3.iData=%d,st3.data\n", st3.iST.iData, st3.data);
        printf("st4.iData=%d\n", st4.iData);
    
        return 0;
    }
    
    
    点赞 评论 复制链接分享

相关推荐