賬戶號碼種類金額搜索特定行C++標籤delmited
15檢查52.42
23節約51.51
11檢查12.21
是我的標籤delmited文件
我希望能夠通過t搜索行他的賬號。說如果我放在23,我想獲得特定的行。 id如何做到這一點?
也更先進,如果我想改變一個具體的價值,比如在帳戶23中說51.51。我如何獲取該值並將其替換爲新值?
到目前爲止IM按行
串線行只是閱讀; ifstream is(「account.txt」); ifstream is(「account.txt」);
if (is.is_open())
{
while (std::getline(is, line)) // read one line at a time
{
string value;
string parseline;
std::istringstream iss(line);
getline(line, parseline);
cout << parseline << endl; // do something with the value
while (iss >> value) // read one value at at time from the line
{
//cout << line << " "; // do something with the value
}
}
is.close();
}
else
cout << "File cant be opened" << endl;
return 0;
如果只有某種方式可以[關係](http://en.wikipedia.org/wiki/Relational_database)方式[查詢](http://www.sqlite.org)數據... – smocking 2012-07-26 18:42:00
@smocking就像你的用戶名符合你的迴應。 – 2012-07-26 18:53:59