二维数组这样传值怎么不对呢?请大家帮帮我吧。
#include<iostream> #include<fstream> #include<string>#include<iomanip>using namespace std; void input_WolfSheep(string s[][]);void ordered_WolfSheep_nls(string s[][]);int main() { string s[200][100]; input_WolfSheep(s); ordered_WolfSheep_nls(s); cout<<endl; system("PAUSE"); return 0; }void input_WolfSheep(string **s){ int i=0,j=0; string name; ifstream infile("WolfSheep.nls",ios::in); if (!infile) { cerr<<"open error!"<<endl; exit(1); } for (i=0;i<200;i++) { for(j=0;j<100;++j) { infile>>s[i][j]; if(s[i][j]==';') break; } } infile.close(); //cout<<endl; }void ordered_WolfSheep_nls(string **s){ int j=0; ofstream outfile("WS_nocomment.nls",ios::out); if(!outfile) { cerr<<"open error!"<<endl; exit(1); } for(int i=0;i<200;i++) { for(j=0;j<100;++j) { if(s[i][j]!=";") { outfile<<s[i][j]; } else { break; } } } outfile.close(); return ;}