- 176 名前:65です [2007/10/25(木) 17:31:19 ]
- >169さん
丁寧にありがとうございます。 はい、アメリカの州は50です。 ところで、私は途中まで以下のようにコードを組み立てたのですが、以下のようなやり方でも、プログラムを完成させることはできますか? #include <iostream> #include <string> #include <fstream> using namespace std; int main (int argc, char **argv) { char peek; ifstream myFile; string cityName, stateName; float gasPrice; myFile.open("gasprice_file.txt"); while((peek = myFile.peek () ) ! = EOF) { myFile >> cityName; myFile >> stateName; myFile >> gasPrice; If(! myFile) { myFile.clear(); cityName = cityName + " " + stateName; myFile >> sateName; myFile >> gasPrice; { myFile.close(); return 0; }
|

|