Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created September 3, 2019 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/fd6052c5ae3804959427f5245b09b918 to your computer and use it in GitHub Desktop.
Save parzibyte/fd6052c5ae3804959427f5245b09b918 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <stdio.h> // Para sscanf
// https://parzibyte.me/blog/2019/06/19/namespaces-cpp-using-namespace/
using namespace std;
int main() {
int numero = 0;
const char *numeroComoCadena = "2811";
// Lo convertimos usando sscanf, que
// escanea datos a partir de una cadena
sscanf(numeroComoCadena, "%d", &numero);
std::cout << "El número es " << numero << " y el doble del mismo es "
<< numero * 2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment