Convert Python program to c++

May 16, 2016 at 12:46pm
Hello, can someone convert me this python script to c++ script please ?

There it's the script, thank you ^^


from math import*
import math


g = 9.81

v= 22.0
x0= 4.0 #Distance x en m
i = 0.01
t=0.5
div = 10000


#am=degrees((math.pi))/4
am=math.pi/4


p = pow(v,2)*(sin(2*am))/g
print("portee max:",p)
print("angle:",degrees(sin(math.pi)))


if p<x0:
print ("impossible")
else:
t = math.pi/div
x = pow(v,2)*(sin(2*(am-t)))/g

while x - i > x0:
print("distance ", x, " angle ", degrees(am-t))

t += math.pi/div
x = pow(v,2)*(sin(2*(am-t)))/g

print("distance ", x, " angle ", degrees(am-t))

May 16, 2016 at 12:48pm
closed account (48bpfSEw)
https://varycode.com/
May 16, 2016 at 2:19pm
He doesn't work...
May 16, 2016 at 7:36pm
closed account (48bpfSEw)
then you have to do it manually:

http://www.unco.edu/nhs/mathsci/ClassSites/hoppercourse/CS102/S08/syntaxcompar.html

Topic archived. No new replies allowed.