Można to zrobić jeszcze prościej niż ze switchami.
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main()
{
string test = "przykladowy tekst, ktory zawiera przecinek i kropki...";
string test2 = test;
replace( test2.begin(), test2.end(), ',', '!'); // zamienia wszystkie , na !
replace( test2.begin(), test2.end(), '.', '!'); // zamienia wszystkie . na !
cout << test << endl << test2 << endl;
return 0;
}