#include <stdio.h>
#include <string.h>
int main(void)
{
int i=1,index;
char word[9]="computer";
char fword[9]="________";
char srch;
while(strcmp(fword,word)!=0)
{
srch=getchar();
i++;
if(strchr(word,srch)!=NULL)
{
index=strchr(word,srch)-word;
fword[index]=word[index];
}
printf("%s\n",fword);
}
printf("%d\n",i);
return 0;
}
이게 내가 문자를 하나씩 넣어서 --------에서 c넣으면 c_______, m 넣으면 c_m_____ 이런식으로 하나씩 집어넣어서 computer 완성하고
친 문자 갯수도 구하는건데 갯수i도 자꾸 두배로 나오고 printf문도 두번씩 실행되는데 왜그런거임? 아무리봐도 while문 안쪽에 구문들이 두번씩 돌아가는지 이해를 못하겠음 좀 도와줘요
불고기먹고싶네
줄바꿈문자는 무시해야됨
ㄴ 무슨말임?