C언어 텍스트 입출력 질문
조회수 327회
#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++;
}
(여기를 모르겟습니다.)
if( number_positive > number_negative ) {
printf("This review is positive");
} else {
printf("This review is negative");
}
fclose(fp1);
fclose(fp2);
fclose(fp3);
}
C언어 텍스트 파일에서 긍정 부정 단어를 비교하는 코딩인데 중간에 코드를 계속 넣어도 잘 되지 않습니다. 도와주셨으면 합니다
-
(•́ ✖ •̀)
알 수 없는 사용자
댓글 입력