Iteration of int like string (Python -> C++) | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Iteration of int like string (Python -> C++)

How to do this on C++ ? number=5342 for a in str(number): my_function(int(a))

2nd May 2020, 12:53 AM
Quarz
1 Antwort
+ 1
#include <cstdlib> for (char c : itoa(number)) my_function (stoi(c));
2nd May 2020, 1:13 AM
Mustafa K.
Mustafa K. - avatar