Possible Duplicate:
Convert Python program to C/C++ code?
I can code in python but have difficulty in writing c++ code, but I have to submit the c++ code, one of my senior suggested me to write the code in python and then write the python code to convert it into c++, I Google it out but cannot find a good guide, Can anybody help me? Your help will be appreciated. Thank you.
-
1Did you mean - writing a converter? Learning C++ will take less time I suppose.Swapnil– Swapnil2013年01月10日 06:13:39 +00:00Commented Jan 10, 2013 at 6:13
-
@ Karthik - Thankyou for immidiate reply, I am not switching to c++ because of the speed, so I am least bother about speed, I just want the code in c++. And looked foe cython but my system is not supporting cython.shreya– shreya2013年01月10日 06:19:49 +00:00Commented Jan 10, 2013 at 6:19
-
@Swapnil - I want to know if any online source is available to convert python to c++.shreya– shreya2013年01月10日 06:21:50 +00:00Commented Jan 10, 2013 at 6:21
-
Possible duplicate of Convert Python program to C/C++ code?jww– jww2019年11月21日 13:31:48 +00:00Commented Nov 21, 2019 at 13:31
2 Answers 2
I wouldn't recommend writing it in Python and then converting to C++. Not only is it double the effort, but the style of Python code is different from C++ code, mainly because Python is dynamically typed and C++ is statically typed.
Comments
I don't have a solution for you but I can only reinforce what others have posted: don't! Even if such a solution exists, the code would very likely be quite bad and inefficient (i.e. because the c++ would have to emulate the dynamic nature of python). Whoever required you to submit c++ code probably had a reason and he will either realize you "cheated" or think you're a very bad programmer. Is this acceptable?