Conversion Error W/ Multidimensional Array

Hello, I just made a cplusplus account. I was having an error when I was backtracking my teacher's example meant for assisting us with the later homework.

***ERROR***
"arp11A_hw5_mod.cpp:24:46: error: invalid conversion from ‘char’ to ‘Shrimp3’ [-fpermissive]"

Do I need to a type for my array?
I will later do the same thing with 'ZERO' to the rest of the function.
-----------------
#include <iostream>
#include <iomanip>
using namespace std;

const int ROWS = 2;
const int COLS = 3;
enum Shrimp3 {ZERO = '!', ONE = '$', TWO = '/', THREE = '%', FOUR = '@', FIVE = '#'};

int main()
{
Shrimp3 crustacean[ROWS][COLS];
int i, j;
char value;

for (i = 0; i < ROWS; i++)
{
for (j = 0; j < COLS; j++)
{
cout << "Enter value for crustacean[" << i << "][" << j << "]: ";
cin >> value;

if (value == 0)
{
crustacean[i][j] = static_cast<char>(ZERO); ***ERROR***
}
else if (value == 1)
{
crustacean[i][j] = ONE;
}

else if (value == 2)
{
crustacean[i][j] = TWO;
}

else if (value == 3)
{
crustacean[i][j] = THREE;
}
else if (value == 4)

{
crustacean[i][j] = FOUR;
}

else
{
crustacean[i][j] = FIVE;
}
}
}

for (i = 0; i < ROWS; i++)
{
for (j = 0; j < COLS; j++)
{
cout << setw(4) << crustacean[i][j];
}

cout << endl;
}

return 0;
}
Last edited on
Topic archived. No new replies allowed.