此代码正在查看分隔文件并查找总面积最小的国家/地区,我为字符串制作了两组定义以便进行比较。代码输出的是maximumCountry函数而不是最小的国家/地区的信息。
while (!in.fail())
{
if (minArea == 0 || Area < minArea)
{
readRecord(in, ISO2, ISO32, ISONumeric2, fips2, Country2, Capital2,
Area2, Population2, Continent2, tld2, CurrencyCode2, CurrencyName2, Phone2,
PostalCodeForm2, PostalCodeRegex2, Languages2, geonameid2, neighbors2,
EquivalentFipsCode2);
minArea = Area2;
}
else {
readRecord(in, ISO, ISO3, ISONumeric, fips, Country, Capital,
Area, Population, Continent, tld, CurrencyCode, CurrencyName, Phone,
PostalCodeForm, PostalCodeRegex, Languages, geonameid, neighbors,
EquivalentFipsCode);
}
}
答案 0 :(得分:0)
猜测因为我们缺少很多的信息:
// some init of Area & minArea here
while (!in.fail()) {
if (Area < minArea) {
minArea = Area;
}
readRecord(in, ISO, ISO3, ISONumeric, fips, Country, Capital,
Area, Population, Continent, tld, CurrencyCode, CurrencyName, Phone,
PostalCodeForm, PostalCodeRegex, Languages, geonameid, neighbors,
EquivalentFipsCode);
}