我有一段程序,在这里(两个空行之间)出现了问题!!
#include<iostream.h> #include<fstream.h> #include<string.h> #include<stdlib.h> struct Customer { char Customer_name[10]; char Borrow_filename[10]; float Borrow_date; }; struct Filename { char This_Filename[10]; }; int main() { Filename An_Filename_Arry[20]; Customer An_Custmoer_Arry[20]; Filename temp; int i=0; int n=0;
--------------------- ifstream infile ("E:\\filename.txt",ios::in); if(!infile) { cout<<"Error: file filename.txt can't open!"<<endl; exit(1); } while(infile>>temp) { strcmp(An_Filename_Arry[i],temp); i++; } inlife.close();
------------------------- while (n!=3) { cout<<"which file do you like?"; cin.gets(temp); for(i=0;i<20;i++) { int j; j=strcmp(temp,An_Filename_Arry[i]); if(j==0) goto lab; } cout<<"sorry can't find the file"<<endl; exit(0); lab: cout<<"press enter your name:"; cin>>An_Customer_Arry[n].customer_name; cout<<"press the filename:"; cin>>An_Customer_Arry[n].Borrow_filename; cout<<"press the date:"; cin>>An_Customer_Arry[n].Date; n++; } for(i=0;i<20;i++) cout<<An_customer_Arry[i]<<endl; return 0; }
编译 是出现了这样的提示
Compiling... 电影.cpp E:\程序\电影.cpp(29) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'struct Filename' (or there is no acceptable conversion) E:\程序\电影.cpp(29) : fatal error C1903: unable to recover from previous error(s); stopping compilation Error executing cl.exe.
不知道出了什么原因????
--------------------
尽善尽美