練習 迴圈控制訓練等你來挑戰

2021-10-05 02:36:16 字數 2960 閱讀 8000

難度: 1

行數和每行*的個數,由使用者輸入。

參考:

#include

using

namespace std;

intmain()

cout<

}return0;

}

難度 1.5

參考:

#include

using

namespace std;

intmain()

cout<

}return0;

}

難度: 1.5

參考:

#include

using

namespace std;

intmain()

cout<

}return0;

}

難度係數2.0

參考:

#include

using

namespace std;

intmain()

for(

int k =

0; k < i *2+

1; k++

) cout<

}return0;

}

難度:2.5

列印乘法口訣表

參考:

#include

using

namespace std;

intmain()

} cout<

}return0;

}

輸出所有水仙花數

水仙花數: 3位數字, 各位的立方之和,等於這個數本身.

說明: 嚴格的說只有3位的整數, 才可能是水仙花數

參考:

#include

#include

using

namespace std;

intmain()

}return0;

}

**

輸出指定項的斐波那契數列.

1, 1, 2, 3, 5, 8, 13, 21, …

難度: 2.5

參考:

#include

#include

#include

using

namespace std;

intmain()

if(n ==1)

if(n ==2)

cout<<

"1 1 "

;for

(int i =

3; i <=n; i++

) cout<

return0;

}

輸入乙個10進製的正整數,把它轉換為2進製輸出。

參考:

#include

#include

#include

using

namespace std;

intmain()

;int n;

int i;

cout<<

"please enter a positive integer: "

; cin>>n;

if(n <0)

i =0;

while

(n !=0)

for(i--

; i >=

0; i--

) cout<

return0;

}

輸入乙個2進製正數,把它轉換為10進製輸出。

參考:

#include

#include

using

namespace std;

intmain()

cout<<

"s="

<

return0;

}

輸入乙個字串,然後把這個字串逆轉輸出

參考:

#include

#include

using

namespace std;

intmain()

cout<

return0;

}

迴圈訓練 抗「疫」居家訓練指南迴圈訓練

為了便於大家居家訓練,在此選擇了迴圈訓練法作為保持體能的針對性方法。一 概念 迴圈訓練法是指根據訓練的具體任務,將練習手段設定為若干個練習站,運動員按照既定順序和路線,依次完成每站練習任務的訓練方法。運用迴圈訓練法可有效地激發訓練情緒,通過交替刺激不同體位累積負荷 痕跡 迴圈訓練法的結構因素有每站的...

for迴圈練習

輸入兩個數值 求兩個數的最大公約數和最小公倍數.最小公倍數 num1 num2 最大公約數 1.接收兩個數字 num1 int input num1 num2 int input num2 2.找出兩個數中最小的值 min num min num1,num2 3.最大公約數的範圍在1 min num...

Tensorflow訓練迴圈

def fit loop model,inputs,targets,sample weights none,class weight none,val inputs none,val targets none,val sample weights none,batch size none,epoch...