IT

Printf는 문장의 첫 글자만 표시합니다.

itgroup 2022. 11. 18. 21:34
반응형

Printf는 문장의 첫 글자만 표시합니다.

사용자가 문장을 입력하는 코드를 만들고 for를 사용하여 문장을 5번 반복하지만 이 인쇄물만 문장의 첫 글자입니다.누가 나 좀 도와줘?

#include <stdio.h>
#include <locale.h>

int main(){
    setlocale(LC_ALL, "PORTUGUESE");

    char c;
    int cont;

    printf("Digite uma mensagem:\n");
    scanf("%c", &c);

    for (cont = 1; cont <= 5; cont++){
        printf("%c\n", c);
        }
        return 0;
}

언급URL : https://stackoverflow.com/questions/73594494/printf-only-shows-the-first-letter-of-the-sentence

반응형