424,680 Members | 2,123 Online
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,680 IT Pros & Developers. It's quick & easy.

# Converting a decimal integer number to binary form

 P: 10 Hello, I am receiving the following error: error C2065: 'to_binary' : undeclared identifier while running the code below. If anyone can help I'll appreciate it? Thank you, Tukeind // File: fractal.cxx // A demonstration program for the random_fractal function from Chapter 9. #include // Provides assert #include // Provides EXIT_SUCCESS #include // Provides cin, cout #include "useful.h" // From Appendix H. Provides random_real, display //using namespace std; // PROTOTYPE for the function used in this demonstration program. void random_fractal (double left_height, double right_height, double width, double epsilon); // Precondition: width and epsilon are both positive. // Postcondition: The function has generated a random fractal from a line // segment. The parameters left_height and right_height are the heights of the // two endpoints of the line segment, and the parameter width is the segment's // width. The generation of the random fractal stops when the width of the // line segments reaches epsilon or less. // Method of displaying the output: The height of the right endpoint of // each line segment in the random fractal is displayed by calling the // function display(...). int main( ) { cout << "The decimal number 10 equals "; to_binary( 10 ); cout << " binary." << endl; cout << "The decimal number 100 equals "; to_binary( 100 ); cout << " binary." << endl; cout << "The decimal number 1000 equals "; to_binary( 1000 ); cout << " binary." << endl; cout << "The decimal number 10000 equals "; to_binary( 10000 ); cout << " binary." << endl; return EXIT_SUCCESS; } void to_binary(int number) { if( number == 10) return; to_binary( number / 2); cout << number % 2; } Apr 20 '07 #1