Problems with commas as input
Hi, I'm quite new at C++ and I'm having a problem that's been bugging me for awhile now. I want to read a bunch of numbers like so: 1,2,1,4,5,6
If I input the above like so: "1 2 1 4 5 6", (while commenting the cin>>junk;), it works perfectly. Whenever I try to use commas, however, the program crashes. If anyone could tell me why, I'd be grateful. Here's my input code:
int player; //Array - Player statistics
int enemy; //Array - Enemy statistics
int dice; //Array - Dice
int size=0; //Number of squares with markers (player)
int size2=0; //See above, but for enemy
char junk; //Takes in the junk commas in the input
for(x=0;x<20;x++) //Sets all elements of the array equal to zero.
size = player*2;
for(x=1;x<=size;x++) //Sets player's numbers (inputted)
size2 = enemy*2;
//I call another function and I do close the brackets to void-function input down here eventually.