首页 > 编程语言 >体积计算器(三种语言)源码、效果图

体积计算器(三种语言)源码、效果图

时间:2024-07-26 21:00:43浏览次数:17  
标签:global 效果图 源码 计算器 print table Ring PI Round

声明

⚠️:英文、藏语翻译均来源网络,若不准确,请于本人联系,请勿抄袭!

源码

# A-1
V = 0 #体积
r = 0 #小半径
R = 0 #大半径
a = 0 #棱长&长
b = 0 #宽
h = 0 #高
DMJ = 0 #底面积
PI = 3.14 #π(保留两位小数)
four_three = 1 / 4 * 3 #四分之三
three_one = 1 / 3 * 1 #三分之一
Round_table_A = 0 #
Round_table_B = 0
Round_table_C = 0
Round_table_ABC = 0
Ring_A = 0
Ring_B = 0
Ring_C = 0

# A-2
CHO = ''#物体
L = ''#语言

# B-1 正方体
def ZFT(a):
    global V
    V = a * a * a
    return V

# B-2 长方体
def CFT(a,b,h):
    global V
    V = a * b * c
    return V
    
# B-3 圆柱体
def YZT(r,h):
    global PI
    global DMJ
    global V
    DMJ = r * r * PI
    V = DMJ * h
    return V
    
# B-4 球体
def QT(r):
    global V
    global four_three
    global PI
    V = four_three * PI * r * r * 3
    return V

# B-5 圆台
def YT(R,r,h):
    global V
    global Round_table_A
    global Round_table_B
    global Round_table_C
    global Round_table_ABC
    global PI
    global three_one
    Round_table_A = PI * h * h
    Round_table_B = PI * R * R
    Round_table_C = PI * r * r
    Round_table_ABC = Round_table_A + Round_table_B + Round_table_C
    V = three_one * Round_table_ABC 
    return V
    
# B-6 圆锥
def YZ(r,h):
    global V 
    global three_one 
    global PI
    V = three_one * PI * r * r * h
    return V
    
# B-7 圆环
def YH(R,r,h):
    global Ring_A
    global Ring_B
    global Ring_C
    global V
    global PI
    Ring_A = R * R * PI
    Ring_B = r * r * PI
    Ring_C = Ring_A - Ring_B
    V = Ring_C * h
    return V
    
def language():
    global L
    print('请选择语言(中/英/藏)')
    print()
    print('Please select the language first(CH/EN)')
    L = input()
    if L == '中' or L == '中文' or L == 'Chinese' or L == 'CH' or L == 'chinois' or L == 'китайский' or L == 'Chinesisch':
        print('好的,已将语言切换为中文!')
        L2 = 1
    elif L == '英语' or L == '英' or L == 'English' or L == 'EN' or L == 'anglais' or L == 'английский' or L == 'Englisch':
        print('Okay,the language has been switched to English!')
        L2 = 2
        
# C 语言选择部分
print('请先选择语言(中/英/藏)')
print('Please select the language first(CH/EN/Tibetan)')
print('སྔོན་ལ་སྐད་ཡིག་འདེམས་རོགས།(རྒྱ་དངོས།དབྱིན་དངོས།བོད་དངོས།)')
L = input()
if L == '中' or L == '中文' or L == 'Chinese' or L == 'CH' or L == 'chinois' or L == 'Chinesisch' or L == 'དཀྱིལ་':
    print('好的,已将语言切换为中文!')
    L2 = 1
    print('请先选择物体')
    CHO = input('(P.S.正方体/长方体/圆柱体/圆锥/球体

标签:global,效果图,源码,计算器,print,table,Ring,PI,Round
From: https://blog.csdn.net/2401_82814692/article/details/140724342

相关文章