標題:
for 迴圈 (三)
[打印本頁]
作者:
鄭又綸
時間:
昨天 16:31
標題:
for 迴圈 (三)
利用 for 迴圈,在畫面上直列顯示100以內所有2的倍數。
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
for(int i=0; i<=100; i+=2) //i=i+2 i+=2
{
cout<<i<<endl;
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://www.istak.org.tw/seed/)
Powered by Discuz! 7.2