Question: I have this code in C++: #include ConsoleDisplay.h #include using namespace std; static const int width = 10; static const int height = 10; static

I have this code in C++:

#include "ConsoleDisplay.h"

#include

using namespace std;

static const int width = 10;

static const int height = 10;

static const int cont = 3;

static const int over = 100;

int main()

{

ConsoleDisplay display(cont, width, height);

//the error is for the cont

for (int i = 0; i < (cont + over); ++i)

for (int j = 0; j < (height + over); ++j)

for (int k = 0; k < (height + over); ++k)

display.write(i, j, "X");

display.refresh();

while(1);

return 0;

}

And I'm getting this error :

Error C2664 'ConsoleDisplay::ConsoleDisplay(ConsoleDisplay &&)': cannot convert argument 1 from 'const int' to 'const char []'

and then error for the line that have consoleDisplay for the number (3) (ConsoleDisplay display(3, 30, 40);)

Error C2664 'ConsoleDisplay::ConsoleDisplay(ConsoleDisplay &&)': cannot convert argument 1 from 'int' to 'const char []'

#include

#include "BS_Board.h"

#include "ConsoleDisplay.h"

using namespace std;

int main()

{

ConsoleDisplay display(3 //error , 30, 40);

BS_Board board(cin, cout);

display.clear();

board.writeShipGrid(display);

board.writeAttackGrid(display);

display.refresh();

return 0;

}

CONSOLE DISPLAY header file

#ifndef CONSOLEDISPLAY_H

#define CONSOLEDISPLAY_H

#include

#include

class ConsoleDisplay {

public:

typedef std::vector >::iterator screenIt_t;

typedef std::vector::iterator panelIt_t;

// Constructor

ConsoleDisplay(const char w[], const char panels, const char height);

void clear();

void refresh();

void write(const std::string& str);

void write(const unsigned char panel, const std::string& str);

void write(const unsigned char panel, const unsigned char row, const std::string& str);

private:

const std::vector w;

const char h, p;

char lastRow;

std::vector< std::vector > screen;

std::vector stream;

};

#endif // CONSOLEDISPLAY_H

is there anyone can please help me to figure out what should I do?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!