#include<iostream.h> #include<fstream.h> #include<stdlib.h>
void main() { ifstream infile ("data.txt",ios::in|ios::nocreate); if(!infile) { cout<<"can not open!"<<endl; exit(1); } float sum=0,temp; int cout=0; while(infile>>temp) { sum+=temp; cout++; } cout<<"The average is"<<sum/cout; ///////--------------------这里 错!! infile.close(); }
为什么 编译 时老是 出现 这个错啊??
E:\程序\测试.cpp(20) : error C2297: '<<' : illegal, right operand has type 'char [15]' Error executing cl.exe.