V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
fftao
V2EX  ›  问与答

为什么这里显示函数调用缺少参数列表??

  •  
  •   fftao · Dec 26, 2014 · 3618 views
    This topic created in 4142 days ago, the information mentioned may be changed or developed.
    #include <iostream>
    using namespace std;
    class Student
    {
    private:
    char *name;
    float english, math, chinese;
    public:
    Student(char *n, float e, float m, float c)
    {
    name = n; english = e; math = m; chinese = c;
    }
    void showname()
    {
    cout << name << " ";
    }
    float avg()
    {
    cout << (english + math + chinese) / 3;
    }
    };
    void main()
    {
    Student std[3] = {
    Student("li", 77, 88, 99),
    Student("chen", 78, 89, 90),
    Student("wu", 87, 97, 67)
    };
    for (int i = 0; i < 3; i++)
    {
    std[i].showname;
    std[i].avg;
    }
    }
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2628 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 11:29 · PVG 19:29 · LAX 04:29 · JFK 07:29
    ♥ Do have faith in what you're doing.