Created
June 29, 2019 00:27
-
-
Save ampulhetadosaber/40ea466469137f6f27b41f9e91088235 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
string inverso(int x){ // função que retorna o número escrito da direita pra esquerda | |
string retorno; | |
while(x!=0){ | |
int digito = x%10; // digito é último dígito do número | |
retorno += digito+'0'; // retorno recebe o caractere equivalente ao inteiro digito | |
x/=10; // divido x por 10, ou seja, elimino o último dígito de x | |
} | |
return retorno; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment