First post, oh boy... So i finally got around to joining up. Now im checking out all that there is to do on the site. will actually update when i have time between classes
More Blogs
-
1
Wednesday Mar 30, 2005
so, I may actually end up with a summer internship this summer... To… -
0
Wednesday Mar 30, 2005
Man, i love wireless.... im sitting here outside in the sun stealing … -
2
Tuesday Mar 29, 2005
spring has finally arrived... beautiful day out today, spent 2 hours… -
0
Monday Mar 28, 2005
well, it seems im settling in well here... finished up a few more th… -
1
Monday Mar 28, 2005
First post, oh boy... So i finally got around to joining up. Now im …
#include <iostream.h>
void binary(int);
void main(void) {
int number;
cout << "Please enter a positive integer: ";
cin >> number;
if (number < 0)
cout << "That is not a positive integer.\n";
else {
cout << number << " converted to binary is: ";
binary(number);
cout << endl;
}
}
void binary(int number) {
int remainder;
if(number <= 1) {
cout << number;
return;
}
remainder = number%2;
binary(number >> 1);
cout << remainder;
}