0
change code python to c++
for i in range(len(line)): try: if line[i] == '[': if len(line[i:].split(':')[0]) < len(line[i:].split(']')[0]): num1 = int(int(line[i+1:].split(':')[0])/2) num2 = int(int(line[i+1:].split(':')[1])/2) print(num2) line = line[0:i+1]+str(num1)+':'+line[i:].split(':',1)[1] except: pass print(line)
2 Answers
+ 1
In order to translate the Python code into C++, you need to learn C++.
Sololearn has a C++ course:
https://www.sololearn.com/Course/CPlusPlus/?ref=app
If you need help with your own attempt, please LINK it here so we can have a look at it
+ 1
https://www.tangiblesoftwaresolutions.com/product_details/cplusplus-to-JUMP_LINK__&&__python__&&__JUMP_LINK-converter.html
Translate it yourself. Download the tool and install