Trying to learn recursion. Problem asks to use recursion on non-negative number to insert commas. Ex: 20131 as 20,131. My program adds in an extra comma at end. Any help in pushing me in the correct direction to fix this would be appreciated.

Tried to use a 'count' to determine end of number but can not figure it out.

input: 546789301
output: 546,789,301,

#include "stdafx.h"
#include <iostream>
using namespace std;
void commaInsert(int v, int &count)
{
if (v <= 0)
{
count++;
cout<<"Count equals: "<<count<<endl;
return; //base case
}
commaInsert(v/1000, count);
cout<<(v%1000)<<((count=1)?",":"");
return;
}
int main()
{
int input = 546789301, count = 0;
commaInsert(input, count);
cout<<endl;
return 0;
}

Sorry about text screw up. Original question:
Trying to learn recursion. Problem asks to use recursion on non-negative number to insert commas. Ex: 20131 as 20,131.
My program adds an extra comma at end. Any help in pushing me in the right direction would be appreciated.
Tried to use a 'count' to determine end of number, but can not get it working.
input: 546789301
output: 546,789,301,

Walt,
I know why the comma is being output. I don't know how to stop it from being outputted on the last iteration. Maybe my recursion function can not be corrected with the current design? Recursion is difficult and I am looking for some pseudo code ideas to correct my current design. Thanks in advance for your time.

Thanks again Walt. After much time playing around with it I got it working. For any other beginner assigned this puzzle puzzler, here is a working code sample to review.

#include <iostream>
#include <iomanip>
using namespace std;
void commaInsert(unsigned v)
{
//base case
if (v <= 0)
{
return;
}
//main logic
commaInsert(v/1000);
if(v >1000)
{
cout<<",";
cout<<setfill('0')<<setw(3)<<(v%1000); //stores on stack waiting for return
}
else
cout<<(v%1000); //stores on stack waiting for return
return;
}
int main()
{
while (true)
{
unsigned input;
cout<<"Enter an integer to process: ";
cin >> input;
if (input == 0) //special case
cout<<"0"<<endl;
else if (input == 1000) //special case
cout<<"1,000"<<endl;
else
{
commaInsert(input);
cout<<endl;
}
}
return 0;
}

#include <stdio.h>
void outNumber(int num)
{
int part;
if (num < 1000) // Last segment
{
printf("%3d", num); // output it and return
return;
}
part = num % 1000;
num /= 1000;
if (num > 0) outNumber(num);
printf(",%03d", part);
return;
}
int main(int argc, char *argv[])
{
int num = 23456; // Default this number
if (argc > 1) // Allow a number from the command line
num = atoi(argv[1]);
outNumber(num); // Call function
return 0;
}

INGGRIS
How to connect device scanner with visual basic, its analogy I made button scan in vb and typing button scan in press scanner live and walk .. how? Help ...

I have the following problem.
when i pres buttun printpreview (button 5) the the print preview fires up.
and when i close the print preview without printing and minimize the ...