fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5. string editor = "Luiz";
  6. int i = 0;
  7. for (auto l : editor) cout << "Letra: " << l << " Índice: " << i++ << endl;
  8. }
  9.  
  10. //https://pt.stackoverflow.com/q/513673/101
Success #stdin #stdout 0s 5516KB
stdin
Standard input is empty
stdout
Letra: L Índice: 0
Letra: u Índice: 1
Letra: i Índice: 2
Letra: z Índice: 3