Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seeking help in trying to convert Python code into C++

Status
Not open for further replies.

master_reborn

Programmer
Feb 15, 2021
1
US
Hi everyone,

I'm a beginner in C++ and I have been trying to think of ways of replicating a piece of Python code into C++.
1234_oln29y.png
 
If you are an absolute beginner, this is far too complex an example to translate - choose something simpler without lists, sets and dictionaries. In C++ that involves a lot of templates putting you at the very deep end.

Which parts are you having problems with?

OrderedDict = map - but you may have to play with the sets
for loop - if you are using C++11 onwards, it looks almost the same
not in = find
sorted = maybe better to change your list to a vector. You can sort vectors more easily
list = list
enumerate - no need for this, you can just use the list directly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top