Board logo

標題: 2025/4/26冠毅 [打印本頁]

作者: 郭竑志    時間: 2025-4-26 13:36     標題: 2025/4/26冠毅

本帖最後由 郭竑志 於 2025-4-26 15:39 編輯

[今日考試]
106 基本認識 (計算兩點座標的距離)
210 選擇敘述與迴圈 (最大公因數與最小公倍數)
306 函式與陣列 (階乘)
402 字串與檔案處理 (字串比較)
[今日作業]
206~210
作者: 劉冠毅    時間: 2025-4-26 14:05

  1. #include<bits/stdc++.h>
  2. using namespace std;

  3. int main()
  4. {
  5.     float x1,x2,y1,y2,a,b,c;
  6.     cin>>x1>>y1>>x2>>y2;
  7.     a=x2-x1;
  8.     b=y2-y1;
  9.     c=a*a+b*b;
  10.     printf("%.2f",sqrt(c));



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

作者: 劉冠毅    時間: 2025-5-3 14:16

  1. #include<bits/stdc++.h>
  2. using namespace std;

  3. int main()
  4. {
  5.     int a,b,tmp,m=0,h,g;
  6.     cin>>a>>b;
  7.     h=a;
  8.     g=b;

  9.     while(b!=0){
  10.         tmp=b;
  11.         b=a%b;
  12.         a=tmp;
  13.     }
  14.         cout<<a<<endl;

  15.    
  16.    
  17.    
  18.     cout<<h*g/a;


  19.    


  20.     return 0;
  21. }
複製代碼





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