Study:任务(PythonC ++)

  • v6_597390
    了解作者
  • 10.8KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-05 03:25
    上传日期
Study:任务(PythonC ++)
Study-master.zip
  • Study-master
  • Labs
  • C ++
  • Lab_2.cpp
    6.1KB
  • Lab_1.cpp
    4.8KB
  • Lab_3.cpp
    7KB
  • Python
  • Lab 1.py
    2.3KB
  • Lab 4.py
    3.2KB
  • Lab 3.py
    3.6KB
  • Lab 2.py
    1.8KB
内容介绍
#include <iostream> #include <math.h> #include <cmath> #include <cstdlib> using namespace std; /* // 囝滓闐 1 int main() { setlocale(LC_ALL, "rus"); int a, b; a = rand(); b = rand(); if (a%2 == 1 && b%2 == 0) { cout << a; } else if (a%2 == 0 && b%2 == 1){ cout << b; } else if (a%2 == 0 && b%2 == 0){ a +=1; cout << a; } else if (a%2 == 1 && b%2 == 1){ b += 1; cout << a; } return 0; } // 囝滓闐 2 int main() { setlocale(LC_ALL, "rus"); int a, b, c; cout << "�窟摘� 3 擋醜摺磋� 鞣縛�" << endl; cin >> a; cin >> b; cin >> c; if (a < b < c){ cout << "柒窟璃� 鞣縛衛 �隋�綏�� " << b << endl; } else if (b < a < c){ cout << "柒窟璃� 鞣縛衛 �隋�綏�� " << a << endl; } else { cout << "柒窟璃� 鞣縛衛 �隋�綏�� " << c << endl; } return 0; } // 囝滓闐 3 int main() { setlocale(LC_ALL, "rus"); int a; cout << "�窟摘� 鞣縛�" << endl; cin >> a; cout << "決鞅雛羲隆 菴瞄 = " << a * 1024 << endl << "決鞅雛羲隆 蒐餃菴瞄 = " << a * 1024 * 1024 << endl; return 0; } // 囝滓闐 4 int main() { setlocale(LC_ALL, "rus"); int a; cout << "�窟摘� 瘟慮� 縊徵蝓� 錶萄摟� ASCII" << endl; cin >> a; if (a >= 65 && a <= 90){ cout << "�窟粵 蜻� 痢幌慷縈蝗 頑幌琵瘟� 蛭蒲�" << endl; } else if (a >= 97 && a <= 122){ cout << "�窟粵 蜻� 痢幌慷縈蝗 羲曉顏蝗 蛭蒲�" << endl; } else { cout << "�窟粵 蒙蜻�-錙 蜻� =)" << endl; } return 0; } // 囝滓闐 5 int main() { setlocale(LC_ALL, "rus"); int a,b; cout << "�窟摘� 2 擋鳩贖 鞣縛�" << endl; cin >> a; cin >> b; int c = a / b; int d = a % b; if (d == 0){ cout << "臭縛� " << a << " 滇鞅隨� 熱 鞣縛� " << b; cout << " 菌� 褓錶錦�" << endl; cout << "脆羲瘟� 褕 滇雒璃� = " << c << endl; } else { cout << "臭縛� " << a << " 滇鞅隨� 熱 鞣縛� " << b; cout << " � 褓錶錦衛, 蜻錙橢� 縝羲琵��綏 " << d << endl; cout << "脆羲瘟� 褕 滇雒璃� = " << c << endl; } return 0; } // 囝滓闐 6 int main() { setlocale(LC_ALL, "rus"); int a; cout << "�窟摘� 廈�" << endl; cin >> a; if (a % 4 == 0 && a % 100 == 0 && a % 400 == 0){ cout << "�� 閎縝蜻縞癮" << endl; } else { cout << "�� 獗 閎縝蜻縞癮" << endl; } return 0; } // 囝滓闐 7 int main() { setlocale(LC_ALL, "rus"); int a,b,c; cout << "�窟摘� 蜻�繃甕粵靜 蒲琴擋錮蝶� 曖琵獗璃�" << endl; cin >> a >> b >> c; cout << "杗琴擋錮蝦 曖琵獗璃� 慟窠� 閎�: " << a << "x^2 + " << b << "x + " << c << endl; cout << "�鞣縛慟 溘縈撿憂熱瘢 頡 縴整擢� D = " << b << "^2-4*" << a << "*" << c << endl; float D = b * b - 4 * a * c; float x1 = (-b + sqrt(D)) / (2 * a); float x2 = (-b - sqrt(D)) / (2 * a); if (D > 0){ cout << "看� 蒙� 溘縈撿憂熱瘢 菔鼻羅 0 � 擋閑� " << D << " , 錙 曖琵獗璃� 慟窠� 擇羅璃�" << endl; cout << "x1 = " << x1 << endl; cout << "x2 = " << x2 << endl; } else if (D == 0){ cout << "看� 蒙� 溘縈撿憂熱瘢 擋閑� 0, 錙 曖琵獗璃� 慟窠� 錙鼻蜻 蝠瘟 擇羅璃�" << endl; cout << "x = " << x1 << endl; } else { cout << "看� 蒙� 溘縈撿憂熱瘢 褕撿燻鋼鼻磋� � 擋閑� " << D << " , 錙 曖琵獗璃� 擇羅璃� 獗 慟窠�" << endl; return 0; } } // 囝滓闐 8 int main() { setlocale(LC_ALL, "rus"); float x,y; cout << "�窟摘� 蜻褒溘熱靜 � � �" << endl; cin >> x >> y; if (x > 0 && y > 0){ cout << "禺鞭� 頜慚琴雒詬� 1 雛錳綑錚" << endl; } else if ( x < 0 && y > 0){ cout << "禺鞭� 頜慚琴雒詬� 2 雛錳綑錚" << endl; } else if ( x < 0 && y < 0){ cout << "禺鞭� 頜慚琴雒詬� 3 雛錳綑錚" << endl; } else if ( x > 0 && y < 0){ cout << "禺鞭� 頜慚琴雒詬� 4 雛錳綑錚" << endl; } else if (x == 0 && y > 0){ cout << "禺鞭� 頜慚琴雒詬� 1 � 2 雛錳綑���" << endl; } else if (x == 0 && y < 0){ cout << "禺鞭� 頜慚琴雒詬� 3 � 4 雛錳綑���" << endl; } else if (x > 0 && y ==0){ cout << "禺鞭� 頜慚琴雒詬� 1 � 4 雛錳綑���" << endl; } else if (x < 0 && y == 0){ cout << "禺鞭� 頜慚琴雒詬� 2 � 3 雛錳綑���" << endl; } else{ cout << "禺鞭� �隋�綏�� 熱闐餃� 蜻褒溘熱�" << endl; } return 0; } // 囝滓闐 9 int main() { setlocale(LC_ALL, "rus"); float x,y,r; cout << "�窟摘� 蜻褒溘熱靜 � � � 溫� 錙鞭�" << endl; cin >> x >> y; cout << "�窟摘� 擋溘檀 蝌樽豢褓錚" << endl; cin >> r; float h = sqrt(x * x + y * y); cout << "姥罹錙�璃� 褕 熱闐閤 蜻褒溘熱� 溜 錙鞭� = " << h << endl; if (h <= r){ cout << "禺鞭� 頜慚琴雒詬� 蝌樽豢褓錚" << endl; } else{ cout << "禺鞭� 獗 頜慚琴雒詬� 蝌樽豢褓錚" << endl; } return 0; } // 囝滓闐 10 int main() { setlocale(LC_ALL, "rus"); float y,x; cin >> x; if (x > 0){ y = 2 * x - 10; cout << y << endl; } else if (x = 0){ y = 2; cout << y << endl; } else { y = 2 * fabs(x) - 1; cout << y << endl; } return 0; } // 囝滓闐 11 int main(){ setlocale(LC_ALL, "rus"); float a,b,c; cout << "�窟摘� 3 鞣縛�" << endl; cin >> a >> b >> c; if (a > b && a > c){ cout << "拔廖蝓鱟窠 鞣縛� = " << a << endl; } else if (b > a && b > c ){ cout << "拔廖蝓鱟窠 鞣縛� = " << b << endl; } else if (c > a && c > b){ cout << "拔廖蝓鱟窠 鞣縛� = " << c << endl; } return 0; } // 囝滓闐 12 int main() { setlocale(LC_ALL, "rus"); float a,b,c; cout << "�窟摘� 羲褒衝� 隧絛廈鼻璃蒙" << endl; cin >> a >> b >> c; if (a + b <= c || a + c <= b || b + c <= a){ cout << "秒絛廈鼻璃� 獗 翰嚼羲雅綏" << endl; } else if (a != b && a != c && b != c){ cout << "秒絛廈鼻璃� 擋鳩褓錙曉瘩慷" << endl; } else if(a == b == c){ cout << "秒絛廈鼻璃� 擋隅褓錙曉瘩慷" << endl; } else { cout << "秒絛廈鼻璃� 擋隅螂窟擇瘩癮" << endl; } return 0; } // 囝滓闐 13 int main() { setlocale(LC_ALL, "rus"); float a,r; cout << "�窟摘� 羲褒衝� 蒲琴擋錶 � 擋溘檀 蜥擎�" << endl; cin >> a >> r; float Sr = 3.14 * r * r; // 侵請琴� 蜥擎� if (r <= a / 2) { cout << "汰擎 憐詭� 裂靦 隍撇痢 � 蒲痙滓�" << endl; } else if ((a * sqrt(2)) / 2 <= r){ cout << "杗琴擋� 憐詭� 裂靦 隍撇痢 � 蜥擎" << endl; } else{ cout << "拇雛廈 獗 頡骯鞣隨� =)" << endl; } return 0; } // 囝滓闐 14 int main() { setlocale(LC_ALL, "rus"); int x; cout << "�窟摘� 隆鼓痘�" << endl; cin >> x; if (x <= 5){ cout << "仁藩蝓贛慢" << endl; } else if (x >5 && x <= 17){ cout << "頁粵慢" << endl; } else if (x > 17 && x <= 50){ cout << "姥菔錮慢" << endl; } else if (x > 50 && x <= 120){ cout << "青瘡慘獗�" << endl; } else{ cout << "Puncks not dead!" << endl; } return 0; } // 囝滓闐 15 int main() { setlocale(LC_ALL, "rus"); float y,a; cout << "�窟摘� 隆鼓痘� � 隧擊蝴蝗 羲琛" << endl; cin >> a >> y; if (18 <= a < 42 && y >= 20){ cout << "� 熱� 頡煜蝠摘�!" << endl; } else { cout << "押, 獗 頜蝌痞摘" << endl; } return 0; } */
评论
    相关推荐
    • Python
      Python Boto3代码
    • Python
      python程序
    • Python
      Python
    • python
      Python,就在这里。
    • Python
      Python-
    • Python
      完整的python 其中包含用于学习python的代码,注释和微型项目。
    • Python
      项目Python
    • Python
      Pythonpython3中使用乌龟库的简单pong游戏 贡献 拉请求是欢迎的! :) 执照
    • Python
      Python Dit是Mijn储存库van Python
    • python
      Python 基本的python编程