Convert the ada code to its C .
Posted
by maddy
on Stack Overflow
See other posts from Stack Overflow
or by maddy
Published on 2010-04-23T10:58:57Z
Indexed on
2010/04/23
11:03 UTC
Read the original article
Hit count: 358
HI All,
I have a piece of ada code shown below which is a simple switch case statements.Is there any better way to convert this into C.
for I in 1..100 loop
case I is
when 100 =>
Dollars := Dollars + 1;
when 25|50|75 =>
Quarters := Quarters + 1;
when 10|20|30|40|60|70|80|90 =>
Dimes := Dimes + 1;
when 5|15|35|45|55|65|85|95 =>
Nickles := Nickles + 1;
when others =>
Pennies := Pennies + 1;
end case;
end loop;
Now by adding the switch and the case for each values in the case,i can do that conversion,But it seems tyo make the code too big.Is there anywa other simple and compact way.Please get back to me if the question is not clear?
Regards
maddy
© Stack Overflow or respective owner