Im having a bit of trouble converting the delphi code below into c++, i'm sure I need to use a Switch statement but I seem to be getting it wrong. Basically, I have 6 panels mounted on a larger Panel, each caption will contain a random number.
A button then decides the caption of the next panel and compares it to the previous and decides whether it is higher, lower or a pair. Each of those three are pre-defined enumerated types.
I'm just having trouble getting a working version with c++ builder, can anyone help?
case pnlCards.Tag of
0 :
result := prediction;
1..5 :
begin
with pnlCards.Controls[pnlCards.Tag] as TPanel do
begin
if Tag > pnlCards.Controls[pnlCards.Tag-1].Tag then
begin
result := higher;
end;
if Tag < pnlCards.Controls[pnlCards.Tag-1].Tag then
begin
result := lower;
end;
if Tag = pnlCards.Controls[pnlCards.Tag-1].Tag then
begin
result := pair;
end;
end;//with
end;//1..5
end;