//Program to Remove special characters in a String in C++.
#include <iostream>
using namespace std;
int main()
{
const int size = 15;
char string[size] = "1. He. is& me?";
char *sp = string;
for (int i = 0; i<size; i++)
{
if (! ispunct(string[i]) ) //true when character isn't special character.
{
*sp = string[i];
sp++;
}
}
*sp = '\0';
cout << string << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
const int size = 15;
char string[size] = "1. He. is& me?";
char *sp = string;
for (int i = 0; i<size; i++)
{
if (! ispunct(string[i]) ) //true when character isn't special character.
{
*sp = string[i];
sp++;
}
}
*sp = '\0';
cout << string << endl;
return 0;
}