Advertisement
AntonioVillanueva

Posicion en numero entero

Mar 11th, 2016
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. //compilacion g++ -std=c++11 -o NombreEjecutable NombreFuente.cpp
  2.  
  3. #include <iostream>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. int main(){
  9.     int entero(0),posicion(0);
  10.    
  11.     while (true){
  12.         cout <<"Numero : ";
  13.         cin >>entero;
  14.    
  15.         cout <<"Posicion : ";  
  16.         cin>>posicion;
  17.    
  18.         cout << (to_string(entero))[posicion]<<endl;
  19.     }
  20. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement