I need help with this problem, ok so I am making a program for my brother that randomizes 2 things, a Number(1-6) and a Letter(A-E), I go for the randomize 2 numbers, one for the number, and one for the letter. So i was going very well, until I compile it for the final blow, when It comes up with this error:
error C2450: switch expression of type 'System::Random ^' is illegal
No user-defined-conversion operator available, or
Integral expression required
Here is the segment of code it was in, the bold is the line the error is in.
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
label1->Text = ( (int^)randNumGen2->Next(1,5) )->ToString();
label2->Text = ( (int^)randNumGen->Next(1,7) )->ToString();
[B]switch (randNumGen2)[/B]
{
case 1: label1->Text = "A";
break;
case 2: label1->Text = "B";
break;
case 3: label1->Text = "C";
break;
case 4: label1->Text = "D";
break;
case 5: label1->Text = "e";
break;
}
}
Please help.