码迷,mamicode.com
首页 > 其他好文 > 详细

while(t--) 详解

时间:2015-05-30 13:35:32      阅读:310      评论:0      收藏:0      [点我收藏+]

标签:c++

1.判断t是否为真

2.t自减

3.根据1决定是否进入循环


代码:

#include<cstdio>
using namespace std;

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        printf("%d\n",t);
    }
    printf("%d\n",t);
    return 0;
}

测试数据:5

结果:

技术分享

while(t--) 详解

标签:c++

原文地址:http://blog.csdn.net/xky1306102chenhong/article/details/46273837

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!