Hello, my program was to allow the user to enter a value as a C string in the form: xxx,xxx,xxx,xxx,xxx.xx, where x can be any digit. Well, so far here is my attempt. I think the question is, would I have to implement a switch statement for the digits, the comma, and the decimal, so that when a user inputs, let say 52,000.00 the switch statements would read the 1st digit, checks for decimals/commas and if not, proceed to read 2nd digit, and repeat?

A bit overwhelmed with this work, but i'll still rework my coding, just looking for any advice/tips really.
Code:
#include <iostream>
#include <string>

int main() { 
using namespace std;
char buffer[256];
char tempBuff[256] = {'\n'};
double result; 
int count = 0;

cout << "Testing " << endl;

cout << "Enter Any integers: ";
cin.getline(buffer,256);

for(int i = 0; i < strlen(buffer); i++)
{
	if(isdigit(buffer[i]))
	{
		tempBuff[count] = buffer[i];
		count++;
	}

}

if (atof(tempBuff) > 0) { 
result = atof(tempBuff) / 2;

}

cout << endl <<  "The integer you put was: " << tempBuff << " And dividing the integers "<<  
	result << endl;

cin.ignore();
return 0;
}