第一次构造类遇到问题
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class loto_auto_select
{
public:
loto_auto_select()
{
for(int i = 0; i<30; i++)
rand[i] = i+1;
}
void auto_select()
{
random_shuffle( rand.begin(), rand.end() );
copy(rand.begin(), rand.begin()+7, auto_rand.begin());
sort(auto_rand.begin(), auto_rand.end());
}
void display()
{
cout << auto_rand[0];
for(int i = 1; i < 7; i++)
cout << auto_rand[i];
cout << endl;
}
~loto_auto_select();
private:
vector<int> rand(30); // 编译器提示语法错误 : “常数”
vector<int> auto_rand(7);//编译器提示语法错误 : “常数”
};
请各位帮忙。