当前位置:网站首页>for循环的执行顺序
for循环的执行顺序
2022-07-15 17:02:00 【全栈程序员站长】
大家好,又见面了,我是全栈君
一边回顾基础一边记录记录做个整理,这篇关于for循环的执行顺序:
for(表达式1;表达式2;表达式3)
{循环体}
第一步,先对表达式1赋初值;
第二步,判别表达式2是否满足给定条件,若其值为真,满足循环条件,则执行循环体内语句,然后执行表达式3,然后进入第二次循环。若判断表达式2的值为假,就终止for循环,执行循环体外语句。
例一
int main(int argc, char* argv[])
{
for(inti=0;i<5;i++)
cout<<i<<”\t”;
return0;
} /* 何问起 hovertree.com */输出为 0 1 2 3 4
例二
int main(int argc, char* argv[])
{
int i=0;
for(i=0;i<5;i++)
cout<<i<<"\t";
cout<<i<<"\t";
return 0;
} /* 何问起 hovertree.com */输出为 0 1 2 3 4 5
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/120438.html原文链接:https://javaforall.cn
边栏推荐
- Rhcsa note 2
- Type-C application OTG function while charging and transferring data (ldr6028s)
- YYS鼠标连点器
- Mysql高版本报sql_mode=only_full_group_by异常
- Completely clarify stats t. Usage of interval
- Win10右键新建栏目中添加新建Markdown文件(Typora.md)
- The more you sell, the less you earn? Financial analysis thinking of profit growth rate lower than sales growth rate
- H264-解码顺序 显示顺序 参考顺序
- Thumbnail image processing class library
- Processing and analysis of yolov3 training data
猜你喜欢

【使用Win10自带远程连接工具】远程访问并控制【另一台Win10电脑】

9. MySQL -- getting started with JDBC

ITSM确保IT服务台敏捷性的5大实践

String 长度有限制吗?是多少?

Processing and analysis of yolov3 training data

flowable 自定义属性实现和属性获取小记

Private cloud ranking of Tangmen concealed weapons

【面试必刷101】哈希

Thumbnail image processing class library

Compileflow Taobao Workflow Engine
随机推荐
Insert any element at the specified position in the array and delete the element with value x in the array
synchronized的特性与底层原理以及锁的状态和膨胀升级过程
TP5的whereOr方法多条件存在
Sensor principle article
TP5重写分页
Enumeration, do you know it?
TP5--查询字段包含搜索条件的某一个--FIND_IN_SET
MySQL autoincrement, index, foreign key, other operations
LeeCode机器人的运动范围
头文件里面的ifndef /define/endif的作用
LeeCode子数组异或查询
How to save using OpenCV Mp4 format file
1-first knowledge of FPGA
Processing and analysis of yolov3 training data
唐门暗器之私有云排名
PD QC decoy power application IC "liderui ldr6328s" is widely used in all sizes of household appliances
Lifecycle: the foundation of lifecycle aware components - jetpack series (1)
[problems of dft/fft - solutions to fence effect]
60岁开发者的建议,尝试改变一下吧!
Using the array of C to realize the addition, subtraction, multiplication and transpose of matrix