在编写要传递一些参数的构造函数时出现错误。搜索了以前的线程,但我没有清除它。
这是我的代码:
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
using namespace std;
int curr_state;
//int signal[3],trans_in[7],trans_fin[7],trans_sig[7];
class state_machine
{
private :
int start,end;
public :
state_machine(const int Q[],const int signals[],const int trans[][10][10],const int start,const int end);
// int mystate();
int run();
int get_signal( );
int get_state();
int change_state();
};
state_machine::state_machine(const int Q[],const int signals[],const int trans[][10][10],const int start,const int end)
{
}
int main(int argc, char * argv[])
{
state_machine s;
int Q[5]={1,2,3,4,5};
int signals[3]={0,1,2};
int trans[][3][1]={{1,0,2},{1,1,0},{1,2,0},{2,0,3},{2,1,0},{2,2,0},{3,0,5},{3,1,4},{3,2,2},{4,0,2},{4,1,0},{4,2,0},{5,0,0},{5,1,0},{5,2,0}};
int start=1,end=5;
//s.state_machine(Q,signals,trans,start,end);
}
获取输出为:
state_machine.cpp: In function ‘int main(int, char**)’:<br>
state_machine.cpp:27:16: error: no matching function for call to ‘state_machine::state_machine()’<br>
state_machine.cpp:21:1: note: candidates are: state_machine::state_machine(const int*, const int*, const int (*)[10][10], int, int)<br>
state_machine.cpp:8:1: note: state_machine::state_machine(const state_machine&)