저는 개인적인 여가와 학습을 위해 프로젝트를 진행하고 있습니다. 그것의 일부는 다음과 같습니다첫 번째 가져 오기 요청을 건너 뛰는 함수 (문자열 #)를 가져옵니다.
#include<stdio.h>
#include<string.h>
wgame()
{
char string3[12], string2[12], string1[12], string4[12], string5[12];
memset (string1, 0, 11);
memset (string2, 0, 11);
memset (string3, 0, 11);
memset (string4, 0, 11);
memset (string5, 0, 11);
printf("reference C correct\n");
printf("Okay, so you want a game. Here's one for you\n\n\n");
printf("This is a word game.\n\n A noun is a person place or thing.\n A verb is
something that you can get up and do.\n A subject is what the conversation is about.\n");
printf("Go ahead, type a subject:\n");
gets(string3);
printf("That's a good one. Now, type a verb:\n");
gets(string2);
printf("How about another:\n");
gets(string4);
printf("Really? Okay. Now, type in a noun:\n");
gets(string1);
printf("Cool. How about typing another noun:\n");
gets(string5);
printf("Allright, here's how your words fit into this game:\n\n\n\n\n");
printf("When the %s was %s the %s %s all the other %s", string1,
string2, string3, string4, string5);
return 4;
}
내 문제는 출력이 "얻는다 (문자열 #)"처음 스킵하고 다음 "의 printf()"로 진행되고 있다는 점이다. 누군가 왜 이것이라고 말할 수 있습니까?
'wgame()'은 (는) int wgame (void)이어야합니다. * 절대 사용하지 말라'gets()'; 안전하게 사용할 수 없으며 언어에서 제거되고 있습니다. 의미있는 변수 이름을 사용하십시오. "마술 숫자"('11','12')를 피하십시오. 들여 쓰기 코드. –