Board logo

標題: 2024/12/13 課堂重點(若恩) [打印本頁]

作者: 郭竑志    時間: 2024-12-13 16:52     標題: 2024/12/13 課堂重點(若恩)

本帖最後由 郭竑志 於 2024-12-13 21:17 編輯

[作業檢查]
104 基本認識 (浮點數總和) + 流程圖繪畫
[課堂重點]
105 基本認識 (總和開根號)
106 基本認識 (計算兩點座標的距離)
107 基本認識 (整數輸出)
108 基本認識 (圓面積)
110 基本認識 (比大小)
201 選擇敘述與迴圈 (奇偶數判斷)
202 選擇敘述與迴圈 (分數調整)
203 選擇敘述與迴圈 (相對應的英文單字)
[今日作業]
109 基本認識 (分數判斷)

作者: 何若恩    時間: 2024-12-13 20:22

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main(int argc, char** argv) {
  4.     int a, b;
  5.     float result;
  6.     cin>>a>>b;
  7.     result=sqrt(a+b);
  8.     cout << "結果=" << fixed << setprecision(2) <<result<< endl;
  9.         return 0;
  10. }
複製代碼

作者: 何若恩    時間: 2024-12-13 20:31

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main(int argc, char** argv) {
  4.     int a, b, c, d;
  5.     float result1,result2,final;
  6.     cin>>a>>b>>c>>d;
  7.     result1=(a-c)*(a-c);
  8.     result2=(b-d)*(b-d);
  9.     final=sqrt(result1+result2);
  10.     cout << "結果=" << fixed << setprecision(2) <<final<< endl;
  11.         return 0;
  12. }
複製代碼

作者: 何若恩    時間: 2024-12-13 20:47

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main(int argc, char** argv) {
  4.     int a, b, c, d, e, f;
  5.     cout<<"輸入:";   
  6.     cin>>a>>b>>c>>d>>e>>f;
  7.     printf("%10d %10d %10d %10d %10d %10d", a, b, c, d, e, f);
  8.     //cout << "結果=" << fixed << setprecision(2) <<final<< endl;
  9.         return 0;
  10. }
複製代碼

作者: 何若恩    時間: 2024-12-13 20:56

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main(int argc, char** argv) {
  4.     float a, half, area;
  5.     cout<<"輸入直徑:";   
  6.     cin>>a;
  7.     half=a/2;
  8.     area=half*half*3.1415;
  9.     cout << a << endl;
  10.     cout << fixed << setprecision(2) << half << endl;
  11.     cout << fixed << setprecision(4) << area << endl;
  12.         return 0;
  13. }
複製代碼

作者: 何若恩    時間: 2024-12-13 21:06

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main(int argc, char** argv) {
  4.     float a, b, c, ans;
  5.     cin>>a>>b>>c;
  6.     if(60 <= a and a < 100){
  7.         cout<<1<<endl;
  8.     }else{
  9.         cout<<0<<endl;
  10.     }
  11.     ans=(b+1)/10;
  12.     cout << fixed << setprecision(2) << ans << endl;
  13.     if(a>=c){
  14.         cout<<a<<endl;
  15.     }else{
  16.    
  17.         cout<<c<<endl;
  18.     }
  19.         return 0;
  20. }
複製代碼

作者: 何若恩    時間: 2024-12-13 21:09

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main(int argc, char** argv) {
  4.     int a;
  5.     cin>>a;
  6.     if(a%2==0){
  7.         cout<<"even";
  8.     }else{
  9.         cout<<"odd";
  10.     }

  11.         return 0;
  12. }
複製代碼

作者: 何若恩    時間: 2024-12-13 21:15

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main(int argc, char** argv) {
  4.     int a;
  5.     cin>>a;
  6.     if(60<a and a<100){
  7.         cout<<a+10;
  8.     }else if(a<60){
  9.         cout<<a+5;
  10.     }else{
  11.         cout<<"error";
  12.     }

  13.         return 0;
  14. }
複製代碼

作者: 何若恩    時間: 2024-12-13 21:24

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main(int argc, char** argv) {
  4.     int a;
  5.     cin>>a;
  6.     switch(a){
  7.     case 1:
  8.         cout<<"one";
  9.         break;
  10.     case 2:
  11.         cout<<"two";
  12.         break;
  13.     case 3:
  14.         cout<<"three";
  15.         break;
  16.     case 4:
  17.         cout<<"four";
  18.         break;
  19.     default:
  20.         cout<<"error";     
  21.     }
  22.         return 0;
  23. }
複製代碼

作者: 何若恩    時間: 2024-12-13 21:28

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main(int argc, char** argv) {
  4.     int a;
  5.     cin>>a;
  6.     if(60<a and a<100){
  7.         cout<<"pass"<<endl;
  8.     }else if(a<60){
  9.         cout<<"fail"<<endl;
  10.     }else{
  11.         cout<<"error"<<endl;
  12.     }
  13.     if(a%2==0){
  14.         cout<<"even";
  15.     }else{
  16.         cout<<"odd";
  17.     }
  18.         return 0;
  19. }
複製代碼





歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/) Powered by Discuz! 7.2