goto 语句(虽然不提倡使用goto 但是比赛的时候还蛮好用滴)

/// goto part2;
///part2: printf("Refined analysis:\n");
///格式 goto <标号>;
///其中标号需要申请,在程序开头写label <标号1>,<标号2>,……;
///其中,标号必须为四位以内的正整数。

///在该段落内还需要有<标号>:语句 表示将要转向的方向。

if (size>12)
    goto a;
goto b;
a:cost = cost * 1.05;
    flag=2;
b:bill = cost *flag;
等价于
if(size>12)
{
    cost = cost * 1.05;
    flag=2;
}
bill = cost *flag;
//
if(ibex > 14)
    goto a;
sheds = 2;
goto b;
a: sheds= 3;
b: help = 2* sheds;
等价于
if(ibex > 14)
    sheds=3;
else
    sheds=2;
help = 2*sheds;
//
readin: scanf("%d", &score);
if(score > 0)
    goto stage2;
lots of statements;
goto readin;
stage2: more stuff;
等价于
scanf("%d", &score);
while(score <= 0)
{
    lots of statements;
    scanf("%d", &score);
}
more stuff;

就这些了  呵呵哒

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值