- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main ()
- {
- cout<<"連續計數"<<endl;
- for(int i=1;i<=10;i++)
- {
- cout<<i<<endl;
- }
- cout<<"======================"<<endl;
- cout<<" 跳躍計數"<<endl;
- for(int j= 1;j<=9;j =j+2)
- {
- cout<<j<<endl;
- }
- cout<<"======================"<<endl;
- cout<<"倒序計數"<<endl;
- for(int k=10;k>=1;k=k-1)
- {
- cout<<k<<endl;
- }
-
- system ("pause");
- return 0;
- }
複製代碼 |