<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12
      CHENSHAOQIU

      導航

       

      實驗任務1

      task1.cpp:

      View Code

      運行測試截圖:

       

       

      實驗任務2

      task2.cpp:

      View Code

      運行測試截圖:

       

       

      實驗任務3

      task3.cpp:

      #include <iostream>
      #include <string>
      #include <algorithm>
      
      bool is_palindrome(std::string s);
      
      int main() {
          using namespace std;
          string s;
      
          while (cin >> s)  // 多組輸入,直到按下Ctrl+Z后結束測試
              cout << boolalpha << is_palindrome(s) << endl;
      }
      
      // 函數is_palindrom定義
      bool is_palindrome(std::string s) {
      
          int len = s.length();
      
          for (int i = 0; i < len / 2; i++) {
      
              if (s.at(i) != s.at(len - i - 1)) {
                  return false;
              }
          }
      
          return true;
      }
      View Code

       

      運行測試截圖:

       

       

       

      實驗任務4

      task4.cpp:

      #include <iostream>
      #include <string>
      #include <algorithm>
      
      std::string dec2n(int x, int n = 2);
      
      int main() {
          using namespace std;
      
          int x;
          while(cin >> x) {
              cout << "十進制: " << x << endl;
              cout << "二進制: " << dec2n(x) << endl;
              cout << "八進制: " << dec2n(x, 8) << endl;
              cout << "十六進制: " << dec2n(x, 16) << endl << endl;
          }
      }
      
      // 函數dec2n定義
      std::string dec2n(int x, int n) {
          std::string result;
          if (x == 0) {
              return "0";
          }
          while (x > 0) {
              int a = x % n;
              if (a < 10) {
                  result += a + '0';
              }
              else {
                  result += (a - 10) + 'A';
              }
              x /= n;
          }
          reverse(result.begin(), result.end());
          return result;
      }
      View Code

       

      運行測試截圖:

       

       

      實驗任務5

      task5.cpp:

       1 #include<iostream> 
       2 #include<iomanip>
       3 using namespace std;
       4 int main()
       5 {
       6     int count=1; 
       7     int i,j;
       8     cout<<"  ";
       9     for(i=97;i<97+26;i++) 
      10     {
      11         cout<<setw(2)<<char(i);
      12     }
      13     cout<<endl;
      14     for(i=1;i<=26;i++)
      15     {
      16         cout<<setw(2)<<i;
      17         for(j=i+1;j<=26;j++)
      18         {
      19             cout<<setw(2)<<char(j+64);
      20         }
      21         for(j=1;j<=i;j++)
      22         {
      23             cout<<setw(2)<<char(j+64);
      24         }
      25         cout<<endl;
      26     }
      27     return 0;
      28 }
      View Code

       

      運行測試截圖:

       

       

      實驗任務6

      task6.cpp:

       

      #include<iostream>
      #include<vector>
      #include<algorithm>
      #include<iomanip>
      #include<ctime>
      using namespace std;
      int main() {
          int count = 0;
          const int total = 10;
          for (int i = 0; i < total; i++) {
              int num1 = (time(nullptr) + i) % 11;
              int num2 = (time(nullptr) + i + 1) % 11;
              char operation;
              int answer;
              int r = (time(nullptr) + i + 2) % 4;
              switch (r) {
              case 0:
                  operation = '+';
                  answer = num1 + num2;
                  break;
              case 1:
                  operation = '-';
                  if (num1 < num2)
                      swap(num1, num2);
                  answer = num1 - num2;
                  break;
              case 2:
                  operation = '*';
                  answer = num1 * num2;
                  break;
              case 3:
                  operation = '/';
                  while (num1 % num2 != 0)
                      num1 = (time(nullptr) + i + 3) % 11;
                  answer = num1 / num2;
                  break;
              }
              int myanswer;
              cout << num1 << operation << num2 << "=";
              cin >> myanswer;
              if (myanswer == answer) {
                  count++;
              }
          }
          double t = static_cast<double>(count) / (total) * 100;
          cout << "正確率:" << fixed << setprecision(2) << t << "%" << endl;
          return 0;
      }
      View Code

       

      運行測試截圖:

       

       

      posted on 2024-10-16 00:43  陳少秋  閱讀(40)  評論(0)    收藏  舉報
       
      主站蜘蛛池模板: 一区二区三区四区五区自拍| 亚洲AV高清一区二区三区尤物| 免费特黄夫妻生活片| 中文字幕在线国产精品| 四川丰满少妇无套内谢| 欧美日韩国产图片区一区| 中文字幕亚洲人妻一区| 中文字幕亚洲综合第一页| AV最新高清无码专区| 国产农村老熟女乱子综合| 精品午夜福利在线观看| 波密县| 国产av一区二区三区无码野战| 亚洲老熟女一区二区三区| 亚洲免费视频一区二区三区| 91中文字幕一区在线| 久久精品免视看国产成人| 一本之道高清乱码少妇| 久久久久国产精品人妻| 92国产精品午夜福利免费| 国产精品免费观看色悠悠| 日韩中文字幕v亚洲中文字幕| 久久久久国产精品熟女影院| 天天躁夜夜躁天干天干2020| 久99久热只有精品国产99| 禹城市| 亚洲性日韩精品一区二区| 亚洲综合国产伊人五月婷| 中文国产乱码在线人妻一区二区| 上栗县| 国产极品粉嫩学生一线天| 国产精品亚洲二区亚瑟| 成人天堂资源www在线| 中文字幕一区二区久久综合| 极品粉嫩小泬无遮挡20p| 97亚洲色欲色欲综合网| 精品人妻码一区二区三区| 九九热免费精品视频在线| 亚洲18禁一区二区三区| 国产一区二区精品久久凹凸| 成人国产亚洲精品一区二区|