c언어 텍스트 파일

조회수 296회
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h> 
#include <string.h>
void main() {
    FILE* fp1;
    FILE* fp2;
    FILE* fp3;
    char p_words[2006][256];
    char n_words[4783][256];
    int number_positive = 0;
    int number_negative = 0;
    fp1 = fopen("positive-words.txt", "r");
    if (fp1 == NULL) {
        fprintf(stderr, "we cannot open the file\n");
        exit(1);
    }
    fp2 = fopen("negative-words.txt", "r");
    if (fp2 == NULL) {
        fprintf(stderr, "we cannot open the file\n");
        exit(1);
    }
    fp3 = fopen("cv000_29416.txt", "r");
    if (fp3 == NULL) {
        fprintf(stderr, "we cannot open the file\n");
        exit(1);
    }
        int count = 0;
    while (fgets(p_words[count], 256, fp1)) {
        count++;
    }
    count = 0;
    while (fgets(n_words[count], 256, fp2)) {
        count++;
    }
    // print list of positive words 
    for (int i = 0; i < 2006; i++) {
        printf("%s", p_words[i]);
    }
    //(이 부분)
    if (number_positive > number_negative) {
        printf("This review is positive");
    }
    else {
        printf("This review is negative");
    }
    fclose(fp1);
    fclose(fp2);
    fclose(fp3);
}

하나의 파일을 읽어서 긍정 단어가 많은지 부정 단어가 많은지 판단하는 프로그램인데 이 부분이라고 써있는 부분을 못하겠어요.

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)