• 카테고리

    질문 & 답변
  • 세부 분야

    프로그래밍 언어

  • 해결 여부

    미해결

왜 작동 안하는지 모르겠습니다.

21.01.22 22:29 작성 조회수 109

0

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

void display(c, rows, cols);

int main()

{

char c;

int rows, cols;

printf("input one char and two int\n");

while ((c = getchar()) != '\n')

{

scanf("%d %d", &rows, &cols);

while (c != '\n') continue;

display(c,rows,cols);

printf("put another char and two int\n");

}

return 0;

}

void display(c, rows, cols)

{

for (int i = 1; i <= rows; i++)

{

for (int j = 1; j <= cols; j++)

{

printf("%c", c);

}

printf("\n");

}

}

scanf밑에 있는 while (getchar() != '\n') continue;  문구를

while (c != '\n') continue; 이렇게 바꿔서 했는데 안되는

이유가 무엇인가요?

답변 2

·

답변을 작성해보세요.

0

김경민님의 프로필

김경민

질문자

2021.01.23

답변 감사합니다!!!

0

안소님의 프로필

안소

2021.01.23

안녕하세요!

https://www.inflearn.com/questions/100574

위 링크의 답변을 참고해주시면 이해되실거에요.