为什么我这个有问题错误显示C1075

来源:4-2 定制自己的容器:结构体和共用体

乖大孙儿

2025-04-11 19:43

#include<iostream>

#include <stdio.h>

struct pupil

{

int maths;

int english;

};

int main()

{

struct pupil pup[50];

{

pup[20].maths = 95;

pup[20].english = 93;

std::cout << pup[20].maths << std::endl;

std::cout << pup[20].english << std::endl;

return 0;

}

不知道有什么问题反正就是显示,C1075{;未找到匹配令牌

写回答 关注

1回答

  • Dragon223
    4天前

    main函数的大括号错了。

    #include<iostream>


    #include <stdio.h>


    struct pupil

    {

        int maths;


        int english;

    };


    int main()

    {


        struct pupil pup[50];


        pup[20].maths = 95;

        

        pup[20].english = 93;

        

        std::cout << pup[20].maths << std::endl;

        

        std::cout << pup[20].english << std::endl;

        

        return 0;


    }


趣味 C++ 入门

C++ 入门,开启趣味学习之旅,揭开 C++ 的神秘面纱,让你不再望而生畏。

31854 学习 · 193 问题

查看课程

相似问题