2014-10-13 2 views
-1

나는 학생의 성적을 기록 할 프로그램을 만들려고하고 있으며 빈도 분포표에서 그 위치를 결정합니다. 기록은 파일에서 나옵니다. 여기에 내 코드 : 또 다른 문제는 말을 보였다"변수 'std :: ifstream myfile'에 초기화자가 있지만 불완전한 유형이 있습니다."

#inlcude<fstream> 
#include<iostream> 
#include<string> 

#include<cstdlib> 
using namespace std; 

int const ns=40; 

int main() 
{ 
int y,x,i,vl=0,l=0,m=0,h=0,vh=0; 
int argr[ns]; 
ifstream myfile ("file.txt", ios::in); 
if (myfile.is_open()) 
{ 
while(getline(myfile,x)) 
for(i=0;i<ns;i++) 
{ 
    argr[i]=x; 



    if(argr[i]<=20 && argr[i]>=0) 
    vl=vl+1; 
    else if(argr[i]<=40 && argr[i]>=21) 
    l=l+1; 
    else if(argr[i]<=60 && argr[i]>=41) 
    m=m+1; 
    else if(argr[i]<=80 && argr[i]>=61) 
    h=h+1; 
    else if(argr[i]<100 && argr[i]>=81) 
    vh=vh+1; 
cout<<"Range\t\tFrequency\n\n"; 
cout<<"0-20\t\t "<<vl<<endl; 
cout<<"21-40\t\t "<<l<<endl; 
cout<<"41-60\t\t "<<m<<endl; 
cout<<"61-80\t\t "<<h<<endl; 
cout<<"81-100\t\t "<<vh<<endl;   
} 
myfile.close(); 
} 
else cout<<"Can't find the file"; 

    return 0; 
} 

는 "Invalud 전처리 지시문 # 포함은"

어떻게해야합니까?

#include<fstream> 

+5

오타. 'inlcude'는'include'가 아닙니다. – juanchopanza

답변

6
#inlcude<fstream> 

변경이 그냥 오타를 가지고 있지만, 끔찍한 IDE의 어떤 종류의 당신은 즉시 당신이 표시되지 않습니다 사용하고 있습니까?

관련 문제