返回列表 發帖
本帖最後由 劉冠毅 於 2025-5-10 15:22 編輯
  1. #include<bits/stdc++.h>
  2. using namespace std;

  3. int main()
  4. {
  5.    float i,o,l;
  6.    cin>>i>>o;
  7.    l=i+o;
  8.     cout<<"result=";
  9.    printf("%.2f\n",sqrt(l));
  10.    //更號 i+o
  11.     return 0;
  12. }
複製代碼

TOP

本帖最後由 劉冠毅 於 2025-5-10 15:29 編輯
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. void compute(int i[3]){
  4.     //索引值1=1 索引值0+索引值2
  5.     if(i[1]==1){
  6.         cout<<i[0]+i[2];
  7.     }else{
  8.         cout<<i[0]*i[2];
  9.          //索引值1=1 索引值0x索引值2
  10.     }

  11. }
  12. int main()
  13. {
  14.    int i[3]={0};
  15.    for(int o=0;o<=2;o++){
  16.     cin>>i[o];
  17.    //輸出
  18.    }
  19.     compute(i);


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

TOP

本帖最後由 劉冠毅 於 2025-5-10 15:25 編輯
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.    string str;
  6.    getline(cin,str);
  7.    for(int i=0;i<str.length();i++){
  8.         if(str[i]>=65 && str[i]<=90){
  9.             str[i]=str[i]+32;
  10.             //大寫變小寫
  11.         }else{
  12.             str[i]=str[i]-32;
  13.             //小寫變大寫
  14.         }

  15.    }



  16.    for(int i=0;i<str.length();i++){

  17.     cout<<str[i];


  18.    }

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

TOP

返回列表