猿问

求大神将这段c++编成c#的语句

nt readObjects(int& nbObj, int& c, vector<int> &obj, string filein){

// Local variables 

istringstream iss;

string parser;

int check = 0;

string nameFile = "F:\\BPP_100_100_0.1_0.7_0.txt";

// File opening

ifstream file(nameFile.c_str(), ios::in);


// File lecture

if (file){

// Number of objects

getline(file, parser);

iss.str(parser);

iss >> nbObj;

iss.clear();


// Capacity

getline(file, parser);

iss.str(parser);

iss >> c;

iss.clear();


// Objects

obj.resize(nbObj);

while (getline(file, parser)){

iss.str(parser);

iss >> obj[check%nbObj];

iss.clear();

check = check + 1;

}


//File closing

file.close();


// Check 

if (!(check == nbObj)){

return -2;

}

}

else{

return -1;

}

return 0;

}


weibo_泾河陈景_0
浏览 1576回答 0
0回答
随时随地看视频慕课网APP
我要回答