Why does the following code not work? It compiles just fine, but s doesn't seem to take.
I want to copy the string str to char* s.
string str;
char* s=" ";
cout<<"\nEnter String: ";
cin>>str;
int len = str.size();
for(int j=0; j<len; j++)
{
if(str[j] >= '0' && str[j] <= '9' || str[j] == '.')
{
*s++ = str[j];
}
}
I want to copy the string str to char* s.
string str;
char* s=" ";
cout<<"\nEnter String: ";
cin>>str;
int len = str.size();
for(int j=0; j<len; j++)
{
if(str[j] >= '0' && str[j] <= '9' || str[j] == '.')
{
*s++ = str[j];
}
}