Transforma decimal a Binario

Programa que transforma de un número decimal a binario.

Scripter

#include <iostream>
#include <list>
using namespace std;
int main()
{
  int n, i;
  list mod{};
  cout << "Write the number to change to binary: ";
  cin >> n;
  for(n; n != 0; n /= 2){
    i = n%2;
    mod.push_front(i);
  }
  for(int val : mod){
    cout << val;
  }
}

Result

Scripter

>>Write the number to change to binary: 73
1001001
...Program finished with exit code 0
Press ENTER to exit console.