for(起始表达式;条件表达式;末尾循环体) { 循环语句; }

注意:for循环中的表达式,要用分号进行分隔
敲桌子案例 :
1 #include <iostream>
2 using namespace std;
3 int main()
4 {
5 for (int i = 1; i < 101; i++)
6 {
7 if (i / 10 == 7 || i % 10 == 7 || i % 7 == 0)
8 {
9 cout << "敲桌子" << endl;
10 }
11 else
12 cout << i << endl;
13 }
14 return 0;
15 }
原创文章,作者:carmelaweatherly,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/275678.html