【发布时间】:2014-02-08 19:48:45
【问题描述】:
我应该如何编写与 C++ 相同的代码?我觉得这很困难..
### X,Y and Z will all be integers (numbers). The user will input a number 3 three times thus determining the type of triangle###
x = int(input("Input your first length: "))
y = int(input("Input your second length: "))
z = int(input("Input your third length: "))
### "=" is an equality operater. If the side of x, y and x are all equal the triangle will be equilateral.###
if (x == y == z):
print ("The program recognises this as an Equilateral triangle.")
【问题讨论】:
-
在 C++ 中不要“转换”而是“编写”一些新代码……当然你需要阅读一本好的 C++ 编程书籍。
-
Python 代码几乎不是算法;您从用户那里获取 3 个整数并测试它们是否都相等。你可以用一句话来描述。
-
在 haskell 中创建一个 python 解析器,它会生成一些 C++ 代码。 (jk)
标签: python c++ python-3.2