Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
binary
#include<iostream> using namespace std; void binary(int num) { int rem; if (num <= 1) { cout << num; return; } rem = num % 2; binary(num / 2); cout << rem; } int main() { int dec, bin; cout << "Enter the number : "; cin >> dec; if (dec < 0) cout << dec << " is not a positive integer." << endl; else { cout << "The binary form of " << dec << " is "; binary(dec); cout << endl; } ret
run
|
edit
|
history
|
help
0
iterator by value, by reference
Dynamically sized array at end of struct
SFINAE with std::enable_if
Hangman
Wide string conversion with multibyte chars
#10.1
Program_1_rstring
LinkedList
Matrix paths right-down only, going through XY
Permute