65,187
社区成员




int main()
{
int i, j;
string _strIn;
vector<vector<string>>stu; //動的な二次元vector配列stuを宣言する
vector<string>_stu; //動的なvector配列_stuを宣言する
string token;
int bugs = 0;
//ifstream fin("E:\\newfile.csv"); //CSV OPEN
ifstream fin("E:\\01.csv");
while (getline(fin,_strIn)) //一行ずつ読み込む
{
stringstream sstr(_strIn);
while (getline(sstr,token,',')) //”、”マックを分けるマックとして、一行の文字列を分ける
{
_stu.push_back(token); //vector配列に文字列を一個ずつ入れる
}
stu.push_back(_stu); //vector配列を二次元vector配列に入れる
_stu.clear(); //_stu リセット
/*cout << _strIn << endl;*/
}
for (i=0;i<stu.size();i++)
{
for (j = 0;j<stu.at(i).size();j++)
{
char x = stu.at(i).at(j)[0];
char y = stu.at(i).at(j)[1];
if (x == '*' || y == '*')
{
bugs++;
cout << "第"; cout << i+1; cout << "行;";
cout << "第"; cout << j+1; cout << "列。";
}
}
cout << endl;
}
cout << "うまく参照していない個数は:";
cout << bugs << endl;
return 0;
}