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)

2nd May 2022, 3:54 PM
Akshat Agarwal
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
2nd May 2022, 3:59 PM
Lisa
Lisa - avatar
2nd May 2022, 4:04 PM
Subhadeep Mandal
Subhadeep Mandal - avatar