Thousands Separator Input
C / C++ / MFC
2
Posts
2
Posters
0
Views
1
Watching
-
Take the input as a string, then strip out the comma and then use
atoi
to convert the string to an integer.string input; int number; cin >> input; int pos = input.find(','); while (pos != -1) { input.replace(pos, 1, ""); pos = input.find(','); } number = atoi(input.c\_str()); cout << number << endl;
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!