Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9024729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:05:51+00:00 2026-06-16T06:05:51+00:00

I am getting an error while writing a constructor which has some arguments to

  • 0

I am getting an error while writing a constructor which has some arguments to be passed. Searched previous threads but I am not getting it cleared.

Here is my code :

#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);
}   

Getting output as :

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&)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T06:05:53+00:00Added an answer on June 16, 2026 at 6:05 am

    The constructor for state_machine expects an int trans[][10][10]. This must be matched by the type of the trans array in main.

    You must change your main to

    int main(int argc, char * argv[])
    {
        int Q[5]={1,2,3,4,5};
        int signals[3]={0,1,2};
        int trans[][10][10]={{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;
        state_machine s(Q,signals,trans,start,end);
        return 0;
    }
    

    Although the initializer list for trans doesn’t fit the required type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While writing file in External SD card I am getting an error EACCESS permission
Getting unexpected identifier error in line 12 while writing a couchapp I am trying
I'm getting access violation while writing error in the below code while putting null
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException Why am I getting this error while starting my server
I keep getting this writing to a closed file error while trying to compile
I am writing the code right, but getting error - missing namespace or assembly
I'm getting some error while pushing my app (already built a Java EE application
I've been using knockout for a while, but in writing up some code examples
getting error while try to start service
Getting error while inserting values into database (SQL Server 2008) Implicit conversion from data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.