#include <iostream>
#include <cctype>

using namespace std;


void iss();

void main()
{

 char str[100];

 cout << \"마침표로 끝난, 읽어들인 문장에서 모든 공백 문자들을 \'-\' 문자로 대체합니다.\\n\";

 cout << \"문장 입력: \";
 cin >> str;

 cout << endl;
 cout << \"대체된 문장은 다음과 같습니다.\" << endl;
 
 iss();

 cout << endl;
 
}

void iss()
{
 char next;

 do
 {

  cin.get(next);

  if(isspace(next))
   cout << \'-\';

  else
   cout << next;

 } while(next != \'.\');
}

실행 시,

a bcde fg.

라고 입력하면 그 결과값이

-bcde-fg.  라고 나오는데

원인 아시는 분 있나요?