#include <iostream>
#include <cctype>
#include <cstring>
using namespace std;
int amountSpace (const char*);
int main()
{
char tmp [80];
int p;
int i;
char* ptr;
int k(0);
do
{
cout <<"Enter tmp-> ";
cin.getline (tmp,80);
ptr=new char [strlen (tmp)+1];
strcpy_s (ptr, strlen (tmp)+1, tmp);
cout <<"\nBefore\t" << ptr << endl;
p=amountSpace(ptr);
if (p==0)
break;
cout<<"Probel -> "<<p<<endl;
cout <<"After\t" << ptr << endl<<endl;
delete [] ptr;
}while(1);
return 0;
}
int amountSpace (const char* pS)
{
int n(0); const char* p(pS);
while (*p)
{
if (isspace (*p)) ++n;
p++;
}
return n;
}
Помогите дописать код (С++)
Код: