I am trying to output an arbitary double number (which might be negative) using only the printDigit for I/O, but when I run this program and you enter in a number is doesn't output anything.
#include <iostream>
using namespace std;
void printDigit( int n )
{
cout<< n;
}
double printOut(int n)
{
if ( n < 0 )
{
cout << "-";
}
n = -n;
if ( n >= 10 )
{
printOut( n / 10 );
printDigit( n % 10);
}
}
int main()
{
double n;
cout << "Please enter a number: ";
cin >> n;
printOut(n);
cout <<endl;
cout <<endl;
system("pause");
return 0;
}